This repository has been archived by the owner on Aug 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CLI.py
73 lines (67 loc) · 3.02 KB
/
CLI.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
65
66
67
68
69
70
71
72
73
import Game
from HumanPlayer import HumanPlayer
from RandomMoveAI import RandomMoveAI
from OneMoveAI import OneMoveAI
from MinMaxAI import MinMaxAI
from MinMaxPrunedAI import MinMaxPrunedAI
from MonteCarloAI import MonteCarloAI
from SimulatedAnnealingAI import SimulatedAnnealingAI
def choosePlayer(option, color):
option = int(option)
if option == 0:
return HumanPlayer(color)
elif option == 1:
return RandomMoveAI(color)
elif option == 2:
return OneMoveAI(color)
elif option == 3:
return MinMaxAI(color, 3)
elif option == 4:
return MinMaxAI(color, 4)
elif option == 5:
return MinMaxAI(color, 5)
elif option == 6:
return MinMaxAI(color, 6)
elif option == 7:
return MinMaxPrunedAI(color, 3)
elif option == 8:
return MinMaxPrunedAI(color, 4)
elif option == 9:
return MinMaxPrunedAI(color, 5)
elif option == 10:
return MinMaxPrunedAI(color, 6)
elif option == 100:
return MonteCarloAI(color)
elif option == 1000:
return SimulatedAnnealingAI(color)
elif option == 1001:
return MinMaxAI(color, 1)
else:
option = input("Please enter a valid option: ")
choosePlayer(option)
def othello(N, isExperiment, experimentX, experimentY):
board, playerXColor, playerYColor, playerXTurn = Game.initializeGame(N, isExperiment)
if not isExperiment:
print("You can either choose to play as a human or have a bot play")
print("Please enter your most preferred option")
print("Enter 0 for Human")
print("Enter 1 for AI that moves randomly")
print("Enter 2 for AI that naively tries to maximize its next turn")
print("Enter 3 for AI that uses the Min-Max algorithm looking 3 moves ahead")
print("Enter 4 for AI that uses the Min-Max algorithm looking 4 moves ahead")
print("Enter 5 for AI that uses the Min-Max algorithm looking 5 moves ahead")
print("Enter 6 for AI that uses the Min-Max algorithm looking 6 moves ahead")
print("Enter 7 for AI that uses the Min-Max Pruning algorithm looking 3 moves ahead")
print("Enter 8 for AI that uses the Min-Max Pruning algorithm looking 4 moves ahead")
print("Enter 9 for AI that uses the Min-Max Pruning algorithm looking 5 moves ahead")
print("Enter 10 for AI that uses the Min-Max Pruning algorithm looking 6 moves ahead")
print("Enter 100 for AI that uses the Monte Carlo algorithm")
print("Enter 1000 for AI that uses the SimulatedAnnealingAI algorithm")
playerX = choosePlayer(input("Enter your option for Player X: "), playerXColor)
playerY = choosePlayer(input("Enter your option for Player Y: "), playerYColor)
else:
playerX = choosePlayer(experimentX[0], experimentX[1])
playerY = choosePlayer(experimentY[0], experimentY[1])
return Game.playGame(N, board, playerX, playerY, playerXTurn, isExperiment)
if __name__ == '__main__':
othello(8, False, None, None)