-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
56 lines (51 loc) · 2.03 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
48
49
50
51
52
53
54
55
56
from Othello import Othello
from Stone import Stone
from player.Q_learning import Q_learning
from player.NextOne import NextOne
from player.CountStone import CountStone
from player.Random import Random
from player.Naive import Naive
from player.MLP import MLP_p
def get_player(mode,name,color,education_bord=None):
if color == 'black':
if mode == 'NextOne':
player =NextOne(Stone("●"),name,education_bord)
elif mode == 'CountStone':
player = CountStone(Stone("●"),name,education_bord)
elif mode == 'Random':
player = Random(Stone("●"),name,education_bord)
elif mode == 'Q_learning':
player = Q_learning(Stone("●"),name,education_bord)
elif mode == 'Naive':
player = Naive(Stone("●"),name,education_bord)
elif mode == 'MLP':
player = MLP_p(Stone("●"),name,education_bord)
else:
if mode == 'NextOne':
player = NextOne(Stone("○"),name,education_bord)
elif mode == 'CountStone':
player = CountStone(Stone("○"),name,education_bord)
elif mode == 'Random':
player = Random(Stone("○"),name,education_bord)
elif mode == 'Q_learning':
player = Q_learning(Stone("○"),name,education_bord)
elif mode == 'Naive':
player = Naive(Stone("○"),name,education_bord)
elif mode == 'MLP':
player = MLP_p(Stone("○"),name,education_bord)
return player
player1 = get_player('MLP','P1','black')
player2 = get_player('Random','P2','white')
player1.battleMode()
game = Othello(nplay=600,show_result=True,show_board=False)
game.play(player1,player2)
# player2 = get_player('Q_learning','P2','white','no')
# game = Othello(nplay=120000,show_result=True,show_board=False)
# game.play(player1,player2)
# player1.q.save('p1.pickle')
# player2.q.save('p2.pickle')
# player1.battleMode()
# print()
# player2 = get_player('Random','P2','white')
# game = Othello(nplay=600,show_result=True,show_board=False)
# game.play(player1,player2)