OSDN Git Service

load しないといけなかったみたいです。
authoryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 29 Dec 2017 00:54:55 +0000 (09:54 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Fri, 29 Dec 2017 00:54:55 +0000 (09:54 +0900)
gote-model.hdf5
network.py
reversi.py
sente-model.hdf5

index 1c61183..0ae5394 100644 (file)
Binary files a/gote-model.hdf5 and b/gote-model.hdf5 differ
index d9e95c2..2f13cfb 100644 (file)
@@ -41,15 +41,10 @@ class  Comp():
             optimizer='adam',
             metrics=['accuracy'])
         
-        
-        s = 'sente-model.hdf5'
-        if os.path.exists(s):
-            self.model1.load_weights(s)
-        s = 'gote-model.hdf5'
-        if os.path.exists(s):
-            self.model2.load_weights(s)
-        
     def sente_stone(self,X_train,Y_train):
+        hdf5_file = 'sente-model.hdf5'
+        if os.path.exists(hdf5_file):
+            self.model1.load_weights(hdf5_file)
         X,Y = np.array(X_train),np.array(Y_train) 
         X = np.reshape(X,[1,64])
         Y = np.reshape(Y,[1,64])
@@ -70,11 +65,13 @@ class  Comp():
         else:
             s = np.argmax(Y)
         print(Y,res)
-        hdf5_file = './sente-model.hdf5'
         self.model1.save_weights(hdf5_file)
         return [s // 8, s % 8]
         
     def gote_stone(self,X_train,Y_train):
+        hdf5_file = 'gote-model.hdf5'
+        if os.path.exists(hdf5_file):
+            self.model2.load_weights(hdf5_file) 
         X,Y=np.array(X_train),np.array(Y_train)
         X = np.reshape(X,[1,64])
         Y = np.reshape(Y,[1,64])
index 0c140ee..22ab57b 100755 (executable)
@@ -241,7 +241,7 @@ player1 = Player()
 player2 = Player()
 index = player1
 player1.stone = black
-player1.auto = False
+player1.auto = True
 player2.auto = True
 player2.stone = white
 stone_grid = StoneGrid()
@@ -274,4 +274,4 @@ while True:
             stone_grid.turn_index += 1            
             ChangePlayer() 
         stone_grid.active = True        
-        
\ No newline at end of file
+        
index 2297131..fb7c6f4 100644 (file)
Binary files a/sente-model.hdf5 and b/sente-model.hdf5 differ