iterations = 100000
print("Input the number of iterations (%d):" % (iterations))
while True:
    input_line = raw_input()
    if input_line.isdigit():
        iterations = int(input_line)
        break
    elif input_line == "":
        break
    else:
        print("Input number:")

# 学習
for i in xrange(iterations):
    game = Game(com_1, com_2)
    if i % 1000 == 0:
        print("training iterations: No.%d" % (i))
        game.start(True)
    else:
        game.start(False)

# com同士のデモンストレーション
com_1.training = False
com_1.verbose = True
com_2.training = False
com_2.verbose = True

game = Game(com_1, com_2)
game.start(True)
com_1 = SarsaCom(Mark(Maru()), value)
com_2 = SarsaCom(Mark(Batsu()), value)

print("Input the number of iterations:")

iterations = 10000
while(True):
    input_line = raw_input()
    if input_line.isdigit():
        iterations = int(input_line)
        break
    else:
        print("Input number:")

for i in xrange(iterations):
    game = Game(com_1, com_2)
    game.start()
    if i % 1000 == 0:
        print("training iterations: No.%d" % (i))


com_1.training = False
com_2.training = False

while(True):
    print("Select a type of fight [1, 2, 3, q]")
    print("1: human vs com2")
    print("2: com1 vs human")
    print("3: com1 vs com2")
    print("q: quit")    
# encoding: utf-8
'''
tic tac toe 手動ゲーム対戦
'''
from mark import Mark
from maru_mark import Maru
from batsu_mark import Batsu

from tic_tac_toe_player import Player
from tic_tac_toe_game import Game

if __name__ == '__main__':
    print("Start Game...")
    player1 = Player(Mark(Maru()))
    player2 = Player(Mark(Batsu()))
    game = Game(player1, player2)
    game.start(verbose=True)
예제 #4
0
iterations = 100000
print("Input the number of iterations (%d):" % (iterations))
while(True):
    input_line = raw_input()
    if input_line.isdigit():
        iterations = int(input_line)
        break
    elif input_line == '':
        break
    else:
        print("Input number:")

# 学習
for i in xrange(iterations):
    game = Game(com_1, com_2)
    if i % 1000 == 0:
        print("training iterations: No.%d" % (i))
        game.start(True)
    else:
        game.start(False)

# com同士のデモンストレーション
com_1.training = False
com_1.verbose = True
com_2.training = False
com_2.verbose = True

game = Game(com_1, com_2)
game.start(True)