-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.py
More file actions
47 lines (41 loc) · 1.36 KB
/
game.py
File metadata and controls
47 lines (41 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import random
opp = random.randint(14, 23)
score = 0
x = 'gg'
while x != "n":
x = input("Взять еще карту?\n[y / n] >")
if x == "y":
rand = random.randint(6, 14)
if rand == 11:
print("Вышла карта: Валет")
score += 2
elif rand == 12:
print("Вышла карта: Дама")
score += 3
elif rand == 13:
print("Вышла карта: Король")
score += 4
elif rand == 14:
print("Вышла карта: Туз")
score += 11
else:
print("Вышла карта " + str(rand))
score += rand
print("Очки: " + str(score))
if score > 21:
x = "n"
if x == "n":
print("\n####Итог####\nВаши очки: " + str(score) + "\nОчки противника: " + str(opp))
if score > opp or opp > 21:
if score < 22:
print("\nПобеда")
exit()
if score > 21 and opp < 22:
print("\nПроигрыш")
exit()
else:
print("\nНичья")
elif opp == score and opp < 22 and score < 22:
print("\nНичья")
else:
print("\nПроигрыш")