Ejemplo n.º 1
0
    def get_move(self, board, color, move_num=None,time_remaining=None, time_opponent=None):
        """ Provide an interactive console for the human player to make moves.
        Use parse_input to process the data. """
        # Generate the legal moves
        legal_moves = board.get_legal_moves(color)
        player = {-1 : "(B)", 1 : "(W)"}

        # Request the move
        input = raw_input("Enter your move " + player[color] + ": ")
        move = HumanEngine.parse_input(legal_moves, input)
        while move is None:
            print "This move is invalid. The legal moves are: "
            print_moves(sorted(legal_moves))
            input = raw_input("\nEnter your move " + player[color] + ": ")
            move = HumanEngine.parse_input(legal_moves, input)

        return move
Ejemplo n.º 2
0
    def get_move(self, board, color, move_num=None,
                 time_remaining=None, time_opponent=None):
        """ Provides an interactive console for the human player to make moves.
        Uses parse_input to actually process the data. """
        # generate the legal moves.
        legal_moves = board.get_legal_moves(color)
   
        # request the move
        input = raw_input("Enter your move: ")
        move = HumanEngine.parse_input(legal_moves, input)
        while move is None:
            print "That move is not valid. The legal moves are:"
            print_moves(legal_moves)
            input = raw_input("\nEnter your move: ")
            move = HumanEngine.parse_input(legal_moves, input)

        return move
Ejemplo n.º 3
0
    def get_move(self, board, color, move_num=None,
                 time_remaining=None, time_opponent=None):
        """ Provide an interactive console for the human player to make moves.
        Use parse_input to process the data. """
        # Generate the legal moves
        legal_moves = board.get_legal_moves(color)
        player = {-1 : "(B)", 1 : "(W)"}
   
        # Request the move
        input = raw_input("Enter your move " + player[color] + ": ")
        move = HumanEngine.parse_input(legal_moves, input)
        while move is None:
            print "This move is invalid. The legal moves are: "
            print_moves(sorted(legal_moves))
            input = raw_input("\nEnter your move " + player[color] + ": ")
            move = HumanEngine.parse_input(legal_moves, input)

        return move
Ejemplo n.º 4
0
    def get_move(self,
                 board,
                 color,
                 move_num=None,
                 time_remaining=None,
                 time_opponent=None):
        """ Provides an interactive console for the human player to make moves.
        Uses parse_input to actually process the data. """
        # generate the legal moves.
        legal_moves = board.get_legal_moves(color)

        # request the move
        input = raw_input("Enter your move: ")
        move = HumanEngine.parse_input(legal_moves, input)
        while move is None:
            print "That move is not valid. The legal moves are:"
            print_moves(legal_moves)
            input = raw_input("\nEnter your move: ")
            move = HumanEngine.parse_input(legal_moves, input)

        return move