-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathmain.py
47 lines (42 loc) · 1.52 KB
/
main.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
import checkers
import gamebot
from time import sleep
##COLORS##
# R G B
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
BLACK = (0, 0, 0)
GOLD = (255, 215, 0)
HIGH = (160, 190, 255)
##DIRECTIONS##
NORTHWEST = "northwest"
NORTHEAST = "northeast"
SOUTHWEST = "southwest"
SOUTHEAST = "southeast"
def main():
while True:
game = checkers.Game(loop_mode=True)
game.setup()
bot = gamebot.Bot(game, RED, mid_eval='piece_and_board',
end_eval='sum_of_dist', method='alpha_beta', depth=3)
random_bot_blue = gamebot.Bot(
game, BLUE, mid_eval='piece_and_board_pov', method='alpha_beta', depth=3, end_eval='sum_of_dist')
while True: # main game loop
if game.turn == BLUE:
# TO start player's turn uncomment the below line and comment a couple of line below than that
# game.player_turn()
count_nodes = random_bot_blue.step(game.board, True)
print('Total nodes explored in this step are', count_nodes)
game.update()
else:
# TO start player's turn uncomment the below line and comment a couple of line below than that
# game.player_turn()
count_nodes = bot.step(game.board, True)
print('Total nodes explored in this step are', count_nodes)
game.update()
if game.endit:
break
if __name__ == "__main__":
main()
pass