-
Notifications
You must be signed in to change notification settings - Fork 0
/
Process_game.py
61 lines (57 loc) · 2.24 KB
/
Process_game.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from random import randint
import Methods
def player_vs_stupid_bot ():
name_player = input('Введите свое имя: ')
candies = 2021
max_move = 28
count_for_check_win = candies // max_move
determing_moves = randint(0, 1)
win = False
while not win:
if determing_moves % 2 == 0:
candies = Methods.move_player(name_player, candies, max_move)
else:
candies = Methods.move_stupid_bot(candies, max_move)
if determing_moves >= count_for_check_win - 1:
temp = Methods.check_win(candies, determing_moves, name_player, 'Бот')
if temp:
print(f'{temp} выиграл')
win = True
determing_moves += 1
def player_vs_smart_bot ():
name_player = input('Введите свое имя: ')
candies = 2021
max_move = 28
count_for_check_win = candies // max_move
determing_moves = randint(0, 1)
win = False
while not win:
if determing_moves % 2 == 0:
candies = Methods.move_player(name_player, candies, max_move)
else:
candies = Methods.move_smart_bot(candies, max_move)
if determing_moves >= count_for_check_win - 1:
temp = Methods.check_win(candies, determing_moves, name_player, 'Бот')
if temp:
print(f'{temp} выиграл')
win = True
determing_moves += 1
def player_vs_player ():
name_first_player = input('Введите имя первого игрока: ')
name_second_player = input('Введите имя второго игрока: ')
candies = 2021
max_move = 28
count_for_check_win = candies // max_move
determing_moves = randint(0, 1)
win = False
while not win:
if determing_moves % 2 == 0:
candies = Methods.move_player(name_first_player, candies, max_move)
else:
candies = Methods.move_player(name_second_player, candies, max_move)
if determing_moves >= count_for_check_win - 1:
temp = Methods.check_win(candies, determing_moves, name_first_player, name_second_player)
if temp:
print(f'{temp} выиграл(а)')
win = True
determing_moves += 1