Exemplo n.º 1
0
        public void move(Environment environment, Agent.Action action)
        {
            var position = new Environment.Position();

            switch (action)
            {
            case Agent.Action.MOVE_UP:
                position.y--;
                environment.updateRobotAction(Agent.Action.MOVE_UP, position);
                break;

            case Agent.Action.MOVE_RIGHT:
                position.x++;
                environment.updateRobotAction(Agent.Action.MOVE_RIGHT, position);
                break;

            case Agent.Action.MOVE_DOWN:
                position.y++;
                environment.updateRobotAction(Agent.Action.MOVE_DOWN, position);
                break;

            case Agent.Action.MOVE_LEFT:
                position.x--;
                environment.updateRobotAction(Agent.Action.MOVE_LEFT, position);
                break;

            case Agent.Action.CLEAN:
                break;

            case Agent.Action.PICKUP:
                break;

            case Agent.Action.STAY:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }
        }
Exemplo n.º 2
0
 public static int getDistance(Environment.Position p1, Environment.Position p2)
 {
     return(Math.Abs(p1.x - p2.x) + Math.Abs(p1.y - p2.y));
 }
Exemplo n.º 3
0
 public Cell(int x = 0, int y = 0, State state = State.EMPTY)
 {
     position   = new Environment.Position(x, y);
     this.state = state;
 }
Exemplo n.º 4
0
 public Cell(Environment.Position position, State state = State.EMPTY)
 {
     this.position = position;
     this.state    = state;
 }