-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
39 lines (34 loc) · 987 Bytes
/
test.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
from minmax import AI, State
from copy import deepcopy
from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication, QMainWindow
import Ui_Othello
import sys
from time import sleep
import othello
def t():
state = [[None for i in range(8)] for j in range(8)]
state[0] = [2,2,2,2,2,2,2,2]
state[1] = [2,2,1,1,1,2,2,1]
state[2] = [1,2,2,2,2,2,1,1]
state[3] = [1,2,2,2,1,1,1,1]
state[4] = [1,1,2,2,1,2,1,1]
state[5] = [1,None,1,1,1,1,1,1]
state[6] = [None,None,1,2,2,2,None,None]
state[7] = [2,2,2,2,2,2,None,None]
for i in range(8):
for j in range(8):
if not state[i][j] is None:
state[i][j] = (state[i][j]%2) +1
return state
state = State(t)
ia = AI()
app = QApplication(sys.argv)
MainWindow = QMainWindow()
gui = Ui_Othello.Ui_MainWindow()
gui.setupUi(MainWindow)
MainWindow.show()
gui.tour = not gui.tour
print(othello.human_play(state,6,6,2))
othello.gameloop(state,ia,gui)
sys.exit(app.exec_())