Ejemplo n.º 1
0
        //Used when the robot moves *only*, otherwise, the perception will be checked from the state of the unit.
        //Generates percepts, and not MoveResults.
        public Percept percieve(Move move_to_check)
        {
            BaseSquare bender_location = board_data[bender.x_coordinate][bender.y_coordinate];

            if (move_to_check != Move.grab() && ((BoardSquare)bender_location).check_if_walls_prevent_move(move_to_check))
            {
                return(Percept.wall()); //Wall percieved
            }
            else
            {
                int percieve_x = bender.x_coordinate + move_to_check.grid_adjustment[0];
                int percieve_y = bender.y_coordinate + move_to_check.grid_adjustment[1];

                BaseSquare percieve_location = board_data[percieve_x][percieve_y];
                if (percieve_location.beer_can_present)
                {
                    return(Percept.can());
                }
                else
                {
                    return(Percept.empty());
                }
            }
        }