This commit is contained in:
2024-05-24 10:09:50 +02:00
parent cfe3d3f329
commit c390a3eb9a
8 changed files with 68 additions and 23 deletions

View File

@ -20,7 +20,7 @@ def pick_fonts(game_length: int):
return [(i, FONTS[i]) for i in font_list]
def start_game(game_length: int = 10) -> str:
def start_game(game_length: int = 10, hard_mode: bool = False) -> str:
picked_fonts = pick_fonts(game_length)
images = []
for font in picked_fonts:
@ -33,7 +33,8 @@ def start_game(game_length: int = 10) -> str:
"i": "0",
"game_length": str(game_length),
"images": ','.join(images),
"fonts": ','.join(i[0] for i in picked_fonts)
"fonts": ','.join(i[0] for i in picked_fonts),
"hard_mode": str(hard_mode)
}
game = "\n".join([f"{key}:{value}" for key, value in game_dict.items()])
@ -48,7 +49,8 @@ def test_game(game_id: str):
def guess_font(game_id: str, font_guess: str):
game_dict = read_file(f"current_games/{game_id}")
i = int(game_dict['i'])
font = game_dict['fonts'].split(',')[i]
font_guess = font_guess.lower().replace(" ","-")
font = game_dict['fonts'].split(',')[i].lower().replace(" ","-")
if font_guess == font:
game_dict['points'] = str(int(game_dict['points']) + 1)