From 48a24e1bd46bc5e1dab8cefbd0304e9ebc52647b Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 12 Nov 2023 18:50:44 -0700 Subject: [PATCH] Add Hitchhiker's game --- main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/main.py b/main.py index 9046cd5..3bfc03d 100755 --- a/main.py +++ b/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)