2018-03-04 16:35:36 +00:00
|
|
|
from network import Network
|
|
|
|
import tensorflow as tf
|
|
|
|
import random
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
|
2018-04-29 10:14:14 +00:00
|
|
|
from board import Board
|
2018-03-04 16:35:36 +00:00
|
|
|
|
2018-04-29 10:14:14 +00:00
|
|
|
import main
|
2018-03-04 16:35:36 +00:00
|
|
|
|
2018-04-29 10:14:14 +00:00
|
|
|
config = main.config.copy()
|
2018-05-09 20:22:12 +00:00
|
|
|
config['model'] = "eager_testings"
|
2018-04-29 10:14:14 +00:00
|
|
|
config['force_creation'] = True
|
2018-05-08 22:33:05 +00:00
|
|
|
config['board_representation'] = 'quack-fat'
|
2018-04-29 10:14:14 +00:00
|
|
|
network = Network(config, config['model'])
|
2018-03-04 16:35:36 +00:00
|
|
|
|
2018-05-08 22:33:05 +00:00
|
|
|
network.restore_model()
|
2018-04-29 10:14:14 +00:00
|
|
|
initial_state = Board.initial_state
|
|
|
|
|
|
|
|
initial_state_1 = ( 0,
|
|
|
|
0, 0, 0, 2, 0, -5,
|
|
|
|
0, -3, 0, 0, 0, 0,
|
|
|
|
-5, 0, 0, 0, 3, 5,
|
|
|
|
0, 0, 0, 0, 5, -2,
|
|
|
|
0 )
|
|
|
|
|
|
|
|
initial_state_2 = ( 0,
|
|
|
|
-5, -5, -3, -2, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 15, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0,
|
|
|
|
0 )
|
|
|
|
|
|
|
|
boards = {initial_state,
|
|
|
|
initial_state_1,
|
|
|
|
initial_state_2 }
|
|
|
|
|
|
|
|
|
2018-05-01 18:39:29 +00:00
|
|
|
|
|
|
|
|
2018-05-08 22:33:05 +00:00
|
|
|
|
2018-05-01 18:39:29 +00:00
|
|
|
|
2018-05-08 22:33:05 +00:00
|
|
|
board = network.board_trans_func(Board.initial_state, 1)
|
2018-05-10 08:49:25 +00:00
|
|
|
|
2018-05-08 22:33:05 +00:00
|
|
|
|
2018-05-09 20:22:12 +00:00
|
|
|
pair = network.make_move(Board.initial_state, [3,2], 1)
|
|
|
|
|
|
|
|
print(pair[1])
|
|
|
|
|
|
|
|
network.do_backprop(board, 0.9)
|
|
|
|
|
2018-05-08 22:33:05 +00:00
|
|
|
|
2018-05-10 08:49:25 +00:00
|
|
|
network.print_variables()
|
2018-05-01 18:39:29 +00:00
|
|
|
|
2018-04-29 10:14:14 +00:00
|
|
|
|
2018-05-10 08:49:25 +00:00
|
|
|
network.save_model(2)
|
2018-04-29 10:14:14 +00:00
|
|
|
|
2018-05-10 16:41:21 +00:00
|
|
|
network.calculate_1_ply(Board.initial_state, [3,2], 1)
|