Exemplo n.º 1
0
from DepreciatedBoard.Board import Board
from Constants import constant
from Agents.Minimax import Minimax

# create a new board game
board_game = Board()

board_game.print_board()

# create the starting node -- this node is black
node = Minimax.create_node(board_game, constant.BLACK_PIECE, None)
node.board.print_board()
print(node.available_moves)
print(node.colour)
print()

# to create a child node we apply one of the move from black to the next node
child = Minimax.create_node(node.board,Board.get_opp_piece_type(node.colour),node.available_moves[2])
child.board.print_board()
print(len(child.available_moves))
print(child.colour)
print()

print("UNDO MOVE")
child.board.undo_move()
child.board.print_board()
print(child.board.eliminated_pieces)
print(child.board.piece_pos)

child = Minimax.create_node(child.board,Board.get_opp_piece_type(child.colour),child.available_moves[3])
child.board.print_board()
Exemplo n.º 2
0
from Agents.Minimax import MinimaxABUndo
from DepreciatedBoard.Board import Board
from Constants import constant

board = Board()
colour = constant.WHITE_PIECE
board.print_board()
agent = MinimaxABUndo(board)

root = agent.create_node(colour, None)

agent.update_minimax_board(None, root, start_node=True)

action = agent.alpha_beta_minimax(3, root)

print(action)