Add drugwars game

This commit is contained in:
2026-02-18 03:54:21 +00:00
parent 52c417b176
commit 8b65026401

14
main.py
View File

@@ -49,6 +49,7 @@ KEY_SPACE = 32
TIMEZONE_CALGARY = pytz.timezone('America/Edmonton')
DRUGWARS_LOCATION = '/home/pi/protovac/env/bin/drugwars'
NETHACK_LOCATION = '/usr/games/nethack'
MORIA_LOCATION = '/usr/games/moria'
_2048_LOCATION = '/home/pi/2048-cli/2048'
@@ -56,6 +57,7 @@ FROTZ_LOCATION = '/usr/games/frotz'
HITCHHIKERS_LOCATION = '/home/pi/frotz/hhgg.z3'
SUDOKU_LOCATION = '/usr/games/nudoku'
HAS_DRUGWARS = os.path.isfile(DRUGWARS_LOCATION)
HAS_NETHACK = os.path.isfile(NETHACK_LOCATION)
HAS_MORIA = os.path.isfile(MORIA_LOCATION)
HAS_2048 = os.path.isfile(_2048_LOCATION)
@@ -1168,6 +1170,8 @@ while True:
stdscr.addstr(14, 4, '[H] Hitchhiker\'s Guide to the Galaxy', curses.A_REVERSE if highlight_keys else 0)
if HAS_SUDOKU:
stdscr.addstr(16, 4, '[S] Sudoku', curses.A_REVERSE if highlight_keys else 0)
if HAS_DRUGWARS:
stdscr.addstr(18, 4, '[D] Drugwars', curses.A_REVERSE if highlight_keys else 0)
stdscr.addstr(23, 1, '[B] Back', curses.A_REVERSE if highlight_keys else 0)
@@ -1690,7 +1694,7 @@ I will be terse in my responses.
stdscr.keypad(False)
curses.echo()
curses.endwin()
logging.info('Spawning moria.')
logging.info('Spawning 2048.')
os.system(_2048_LOCATION)
break
elif button == 'm' and HAS_MORIA:
@@ -1709,6 +1713,14 @@ I will be terse in my responses.
logging.info('Spawning nethack.')
os.system(NETHACK_LOCATION)
break
elif button == 'd' and HAS_DRUGWARS:
curses.nocbreak()
stdscr.keypad(False)
curses.echo()
curses.endwin()
logging.info('Spawning drugwars.')
os.system(DRUGWARS_LOCATION)
break
else:
try_highlight()