initial commit
This commit is contained in:
43
cli_race.py
Executable file
43
cli_race.py
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
from game import CamelGame
|
||||
|
||||
game = CamelGame()
|
||||
|
||||
if __name__ != '__main__':
|
||||
print("Not a module!")
|
||||
exit(1)
|
||||
|
||||
|
||||
def print_game():
|
||||
print(f'status: {game.state}')
|
||||
print(', '.join(game.get_open_side_cards()))
|
||||
for ace, pos in game.ace_position.items():
|
||||
print(" " * 4 * pos + ace)
|
||||
|
||||
|
||||
def print_drinks():
|
||||
drinks = game.get_drinks()
|
||||
if drinks is None:
|
||||
print("Not done yet!")
|
||||
return
|
||||
for user, amount in drinks.items():
|
||||
print(f"{user:16}{amount}")
|
||||
|
||||
|
||||
while True:
|
||||
inp = input("command: ")
|
||||
if inp == 'r':
|
||||
game.do_round()
|
||||
print_game()
|
||||
elif inp == 'i':
|
||||
game.init_game()
|
||||
elif inp.startswith('b '):
|
||||
_, u, s, a = inp.split()
|
||||
a = int(a)
|
||||
game.bet(u, s, a)
|
||||
elif inp == 's':
|
||||
game.start_game()
|
||||
elif inp == 'd':
|
||||
print_drinks()
|
||||
else:
|
||||
print("Unknown " + inp)
|
||||
Reference in New Issue
Block a user