def test1():
	player1 = MinimaxPlayer()
	player2 = MinimaxPlayer()
	game = Board(player1, player2)
	# game.apply_move((1,1))
	# game.apply_move((2,2))
	# print (game._board_state)
	# print(game.to_string())
	# print(len(game._board_state))

	explored = [9,11,12,14,15,16,17,20,24,25,29,30,33,38,39,44]
	for i in explored:
		game._board_state[i] = 1
	game._board_state[-1] = 17
	game._board_state[-2] = 9


	# game.apply_move((5, 3)) # player 1
	# game.apply_move((4, 2)) # player 2

	print (game.to_string())
	moves = game.get_legal_moves()
	print(moves)
	for m in moves:
		fm = game.forecast_move(m).get_legal_moves()
		print (str(m) + " -->" + str(fm))

	# player 1
	for m in moves:
		print (str(m) + " --> " + str(player1.score(game.forecast_move(m), player1)))
	print (player1.get_move(game, 6))
Ejemplo n.º 2
0
def test2():
    player1 = MinimaxPlayer(search_depth=1)
    player2 = MinimaxPlayer(search_depth=0)
    game = isolation.Board(player1, player2, height=4, width=4)
    game.apply_move((2, 0))
    game.apply_move((0, 1))
    game.apply_move((1, 2))
    game.apply_move((2, 2))
    game.apply_move((3, 1))
    print(game.to_string())
    print(player2.score(game, player1))