-
Notifications
You must be signed in to change notification settings - Fork 0
/
AI_vs_AI.py
64 lines (51 loc) · 1.6 KB
/
AI_vs_AI.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
62
63
64
from utils import *
def AI_VS_AI(heuristic1):
board = []
for i in range(24):
board.append("x")
evaluation = evaluate()
print("Stage 1")
for i in range(9):
count(board)
printBoard(board)
print("A Turn :")
evalBoard = minimax(
board, ai_depth, True, alpha, beta, True, heuristic1)
if evalBoard.evaluate == float('inf'):
print("AI Bot 1 has won!")
exit(0)
else:
board = evalBoard.board
count(board)
printBoard(board)
print("B Turn :")
evalBoard = minimax(
board, ai_depth, False, alpha, beta, True, heuristic1)
if evalBoard.evaluate == float('-inf'):
print("AI Bot 2 has won!")
exit(0)
else:
board = evalBoard.board
print("Stage 2")
while True:
count(board)
printBoard(board)
print("A Turn :")
evalBoard = minimax(
board, ai_depth, True, alpha, beta, False, heuristic1)
if evalBoard.evaluate == float('inf'):
print("AI Bot 1 has won!")
exit(0)
else:
board = evalBoard.board
count(board)
printBoard(board)
print("B Turn :")
evaluation = minimax(
board, ai_depth, False, alpha, beta, False, heuristic1)
if evaluation.evaluate == float('-inf'):
print("AI Bot 2 has won")
exit(0)
else:
board = evaluation.board
AI_VS_AI(potentialMillsHeuristic)