backgammon/network_test.py

60 lines
1.2 KiB
Python
Raw Permalink Normal View History

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()
config['model'] = "player_testings"
config['ply'] = "1"
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
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 }
# board = network.board_trans_func(Board.initial_state, 1)
# pair = network.make_move(Board.initial_state, [3,2], 1)
# print(pair[1])
# network.do_backprop(board, 0.9)
# network.print_variables()
2018-04-29 10:14:14 +00:00
# network.save_model(2)
2018-04-29 10:14:14 +00:00
# print(network.calculate_1_ply(Board.initial_state, [3,2], 1))
network.play_against_network()