self.model1.add(Dense(50,input_shape=(64,)))
self.model1.add(Activation('relu'))
+ self.model1.add(Dropout(0.25))
self.model1.add(Dense(100))
self.model1.add(Activation('relu'))
+ self.model1.add(Dropout(0.25))
self.model1.add(Dense(64))
self.model1.add(Activation('softmax'))
metrics=['accuracy'])
self.model2.add(Dense(50,input_shape=(64,)))
- self.model2.add(Activation('relu'))
+ self.model2.add(Activation('sigmoid'))
+ self.model2.add(Dense(100))
+ self.model2.add(Activation('sigmoid'))
self.model2.add(Dense(64))
self.model2.add(Activation('softmax'))
self.model2.compile(
for i in range(10):
self.model1.fit(X,Y)
res = self.model1.predict(X,1)
- s = np.argmax(res)
- if Y[0][s] != -1:
- print('hit!')
+ while True:
+ s = np.argmax(res)
+ if res[0][s] == 0:
+ s = np.argmax(Y)
+ print('miss!')
+ elif Y[0][s] == -1:
+ res[0][s] = 0
+ print('next')
+ continue
+ else:
+ print('hit!')
break
else:
s = np.argmax(Y)
for i in range(10):
self.model2.fit(X,Y)
res = self.model2.predict(X,1)
- s = np.argmax(res)
- if Y[0][s] != -1:
- print('hit!')
+ while True:
+ s = np.argmax(res)
+ if res[0][s] == 0:
+ s = np.argmax(Y)
+ print('miss!')
+ elif Y[0][s] != -1:
+ print('hit!')
+ else:
+ res[0][s] = 0
+ print('next')
+ continue
break
else:
s = np.argmax(Y)
for i in range(8):
for j in range(8):
self.CalScore(stone, i, j)
- if self.score != -1:
+ if self.score != 0:
if x == False:
x = True
self.arr.grid[i][j] = self.score
if self.score > n:
n = self.score
else:
- self.arr.grid[i][j] = -1
+ self.arr.grid[i][j] = 0
if n > 0:
for i in range(8):
for j in range(8):
k = self.arr.grid[i][j]
- if k != -1:
+ if k != 0:
self.arr.grid[i][j] = k / n
def Start(self):
player2 = Player()
index = player1
player1.stone = black
-player1.auto = False
+player1.auto = True
player2.auto = True
player2.stone = white
stone_grid = StoneGrid()