示例#1
0
import common.perceptron as nn

import numpy as np
import random

import tensorflow as tf
import sys

model_file1 = sys.argv[1]
layer1 = int(sys.argv[2])

model_file2 = sys.argv[3]
layer2 = int(sys.argv[4])

b = bm.BoardManager()
n1 = nn.Perceptron(layer1, 81, 81)
n1.load(model_file1)

n2 = nn.Perceptron(layer2, 81, 81)
n2.load(model_file2)

ns = [n1, n2]

n_battle = int(sys.argv[5])
count = 0

#b.clear_data(data_file_d)
#b.clear_data(data_file_l)

wins = [0, 0]
示例#2
0
文件: play.py 项目: azumag/gomoku-ai
import common.perceptron as nn

import numpy as np
import random

import tensorflow as tf
import sys

model_file = sys.argv[2]
data_file_d = sys.argv[3]
data_file_l = sys.argv[4]

layer = int(sys.argv[1])

b = bm.BoardManager()
n = nn.Perceptron(layer, 81, 81)

n.load(model_file)

train_n = 10000  # number of train battle
count = 0

#b.clear_data(data_file_d)
#b.clear_data(data_file_l)

while True:
    if count >= train_n:
        count = 0
        n.train(data_file_d, data_file_l, 1)
        n.save(model_file)
        b.clear_data(data_file_d)
示例#3
0
import common.board_manager as bm
import common.perceptron as nn
import sys
import numpy as np
import random

model_file = sys.argv[2]
data_file_d = sys.argv[3]
data_file_l = sys.argv[4]

layer = int(sys.argv[1])

b = bm.BoardManager()
n = nn.Perceptron(layer, 81, 81)

n.train(data_file_d, data_file_l, 1)
n.save(model_file)
n.load(model_file)

n2 = nn.Perceptron(0, 81, 81)

ns = [n, n2]

count = 0

n_battle = int(sys.argv[5])

wins = [0, 0]

while True:
    count += 1