python_rag_system/lesson_4/code/yakubovich.py
2025-10-07 12:08:50 +03:00

71 lines
1.2 KiB
Python

import random
import uuid
from db import DICT_DEFENITION_WORD
name = input("Введите имя:")
def print_menu():
print("""
1. Начать игру
2. Сохранить игру
3. Загрузить игру
4. Выход из игры
5. Настройки
""")
print_menu()
num = int(input("Пункт меню:"))
def generate_key() -> str:
keys = list(DICT_DEFENITION_WORD.keys())
random.shuffle(keys)
return keys.pop()
def start_game():
key = generate_key()
list_word = list(key)
mask = ['#'] * len(key)
print(DICT_DEFENITION_WORD[key])
print(mask)
while '#' in mask:
alfa = input("Введите букву:")
cnt = 0
for i in list_word:
if alfa == i:
mask[cnt] = alfa
cnt += 1
continue
cnt += 1
else:
print(mask)
match num:
case 1:
session_uuid = uuid.uuid4()
start_game()
# print('The UUID is: ' + str(session_uuid))
case 2:
pass
case 3:
pass
case 4:
print(f"Спасибо {name} за игру! Заходи еще! ")
pass