Esempio n. 1
0
 def __init__(self, game_file):
     self.file = game_file
     FILE = open(self.file, 'r')
     source = FILE.read()
     FILE.close()
     self.turn_list = re.split("\n+", source)[:-1]
     self.current_turn = 0
     self.last_turn = len(self.turn_list)
     self.game = Board(player.Player(), player.Player(), TEMP_GAME_FILE)
     self.has_eval = False
     self.eval = None
     self.show_eval = False
     self.pos_value = 0
Esempio n. 2
0
	player2 = player.AI_ABPruning(heuristics.game_heuristic1, show_thought_level)
	if random.randint(0,1) == 0:
		player1 = player.RandomAI()
		print "Player 1 is random"
	else:
		player2 = player.RandomAI()
		print "Player 2 is random"

if watch:
	movie = watcher.Watcher(game_file)
	movie.set_heuristic(heuristics.game_heuristic1)
	movie.set_show_eval(True)
	movie.watch()
else:
	if not test:
		game = Board(player1, player2, game_file, history, load, show=show_board)
		game.play()
	else:
		if this_test == "draw1":
			player1 = player.RandomAI()
			player2 = player.RandomAI()
			max_turns = 0
			counter = 0
			while max_turns < 81:
				game = Board(player1, player2, game_file, history, load, True, show_board)
				game.play()
				counter += 1
				if game.get_turn() >= max_turns:
					game.opg()
					max_turns = game.get_turn()
					print str(max_turns) + " ; " + str(counter)
Esempio n. 3
0
 def is_terminal_node(self):
     game = Board(player.Player(), player.Player(), DEFAULT_GAME_FILE)
     game.load_state_from_string(self.state)
     return game.is_game_over()
Esempio n. 4
0
 def set_children(self):
     game = Board(player.Player(), player.Player(), DEFAULT_GAME_FILE)
     game.load_state_from_string(self.state)
     self.children = sort_into_search_order(game.get_children_states())