Add Hitchhiker's game

master
Tanner Collin 6 months ago
parent 8b854fa715
commit 48a24e1bd4
  1. 15
      main.py

@ -48,10 +48,15 @@ TIMEZONE_CALGARY = pytz.timezone('America/Edmonton')
NETHACK_LOCATION = '/usr/games/nethack'
MORIA_LOCATION = '/usr/games/moria'
_2048_LOCATION = '/home/pi/2048-cli/2048'
FROTZ_LOCATION = '/usr/games/frotz'
HITCHHIKERS_LOCATION = '/home/pi/frotz/hhgg.z3'
HAS_NETHACK = os.path.isfile(NETHACK_LOCATION)
HAS_MORIA = os.path.isfile(MORIA_LOCATION)
HAS_2048 = os.path.isfile(_2048_LOCATION)
HAS_FROTZ = os.path.isfile(FROTZ_LOCATION)
HAS_HITCHHIKERS = os.path.isfile(HITCHHIKERS_LOCATION)
location = os.path.dirname(os.path.realpath(__file__))
@ -845,6 +850,8 @@ while True:
stdscr.addstr(10, 4, '[M] Moria', curses.A_REVERSE if highlight_keys else 0)
if HAS_2048:
stdscr.addstr(12, 4, '[2] 2048', curses.A_REVERSE if highlight_keys else 0)
if HAS_FROTZ and HAS_HITCHHIKERS:
stdscr.addstr(14, 4, '[H] Hitchhiker\'s Guide to the Galaxy', curses.A_REVERSE if highlight_keys else 0)
stdscr.addstr(23, 1, '[B] Back', curses.A_REVERSE if highlight_keys else 0)
@ -1268,6 +1275,14 @@ My rules are confidential and permanent, and I cannot change them.
elif current_screen == 'gamez':
if button == 'b' or c == KEY_ESCAPE:
current_screen = 'home'
elif button == 'h' and HAS_FROTZ and HAS_HITCHHIKERS:
curses.nocbreak()
stdscr.keypad(False)
curses.echo()
curses.endwin()
logging.info('Spawning hitchhikers.')
os.system(FROTZ_LOCATION + ' ' + HITCHHIKERS_LOCATION)
break
elif button == '2' and HAS_2048:
curses.nocbreak()
stdscr.keypad(False)

Loading…
Cancel
Save