Esempio n. 1
0
  @Test
  public void testMoveNextToRobotNotOnBoard() {
    Board board = facade.createBoard(16, 26);
    Board board2 = facade.createBoard(35, 46);
    Robot robot1 = facade.createRobot(0, 3000);
    Robot robot2 = facade.createRobot(1, 3000);

    facade.putRobot(board, 7, 15, robot1);

    facade.moveNextTo(robot1, robot2);

    assertTrue(robot1.getPosition().equals(Position.newPosition(7, 15, board)));
    assertEquals(3000, robot1.getAmountOfEnergy(), epsilon);

    facade.moveNextTo(robot2, robot1);

    assertNull(robot2.getPosition());
    assertEquals(3000, robot2.getAmountOfEnergy(), epsilon);

    facade.putRobot(board2, 12, 23, robot2);

    robot1.moveNextTo(robot2);

    assertTrue(robot1.getPosition().equals(Position.newPosition(7, 15, board)));
    assertEquals(3000, robot1.getAmountOfEnergy(), epsilon);
  }
Esempio n. 2
0
  @Test
  public void testPutRepairKit() {
    Board board = facade.createBoard(7, 16);
    Position position = Position.newPosition(3, 5, board);

    assertEquals(0, position.getElements().size());

    facade.putRepairKit(board, 3, 5, facade.createRepairKit(3547, 364768));

    assertEquals(1, position.getElements().size());
  }
Esempio n. 3
0
  @Test
  public void testPutWall() {
    Board board = facade.createBoard(7, 16);
    Position position = Position.newPosition(3, 5, board);

    assertEquals(0, position.getElements().size());

    facade.putWall(board, 3, 5, facade.createWall());

    assertEquals(1, position.getElements().size());
  }
Esempio n. 4
0
  @Test
  public void testMove() {
    Board board = facade.createBoard(17, 23);
    Position startPosition = Position.newPosition(3, 7, board);
    Robot robotUp = facade.createRobot(0, 1500);
    Robot robotRight = facade.createRobot(1, 1500);
    facade.putRobot(board, 3, 7, robotUp);

    assertEquals(startPosition.X, facade.getRobotX(robotUp));
    assertEquals(startPosition.Y, facade.getRobotY(robotUp));

    facade.move(robotUp);

    assertEquals(Orientation.UP.nextPosition(startPosition).X, facade.getRobotX(robotUp));
    assertEquals(Orientation.UP.nextPosition(startPosition).Y, facade.getRobotY(robotUp));

    facade.putRobot(board, 3, 7, robotRight);

    assertEquals(startPosition.X, facade.getRobotX(robotRight));
    assertEquals(startPosition.Y, facade.getRobotY(robotRight));

    facade.move(robotRight);

    assertEquals(Orientation.RIGHT.nextPosition(startPosition).X, facade.getRobotX(robotRight));
    assertEquals(Orientation.RIGHT.nextPosition(startPosition).Y, facade.getRobotY(robotRight));
  }
Esempio n. 5
0
  @Test
  public void testMoveNextToNoObstacles() {
    Board board = facade.createBoard(16, 26);
    Robot robot1 = facade.createRobot(0, 3000);
    Robot robot2 = facade.createRobot(1, 3000);

    facade.putRobot(board, 7, 15, robot1);
    facade.putRobot(board, 9, 12, robot2);

    facade.moveNextTo(robot1, robot2);

    assertTrue(robot1.getPosition().getNeighbours().contains(robot2.getPosition()));
    assertTrue(
        robot1.getPosition().equals(Position.newPosition(8, 12, board))
            || robot1.getPosition().equals(Position.newPosition(9, 13, board)));
  }
Esempio n. 6
0
  @Test
  public void testMoveNextToSurroundedByRobots() {
    Board board = facade.createBoard(16, 26);
    Robot robot1 = facade.createRobot(0, 6000);
    Robot robot2 = facade.createRobot(0, 3000);

    facade.putRobot(board, 7, 15, robot1);
    facade.putRobot(board, 12, 23, robot2);

    Set<Position> robotsRoundRobot2Positions = new HashSet<Position>();
    for (long x = 10; x < 15; x++) {
      robotsRoundRobot2Positions.add(Position.newPosition(x, 21, board));
      robotsRoundRobot2Positions.add(Position.newPosition(x, 26, board));
    }
    for (long y = 22; y < 26; y++) {
      robotsRoundRobot2Positions.add(Position.newPosition(10, y, board));
      robotsRoundRobot2Positions.add(Position.newPosition(14, y, board));
    }
    for (Position robotPosition : robotsRoundRobot2Positions)
      board.putElement(robotPosition, new Robot(new Energy(1000, unitOfPower.Ws), Orientation.UP));

    facade.moveNextTo(robot1, robot2);

    assertTrue(robot1.getPosition().equals(Position.newPosition(12, 20, board)));
    assertTrue(robot2.getPosition().equals(Position.newPosition(12, 22, board)));
    assertEquals(800, robot1.getAmountOfEnergy(), epsilon);
    assertEquals(2500, robot2.getAmountOfEnergy(), epsilon);
  }
Esempio n. 7
0
  @Test
  public void testMoveNextToDifferentCarriedWeight() {
    Board board = facade.createBoard(16, 26);
    Robot robot1 = facade.createRobot(0, 6000);
    Robot robot2 = facade.createRobot(2, 1000);
    Battery battery =
        new Battery(
            Position.newPosition(7, 15, board),
            new Energy(1000, unitOfPower.Ws),
            new Weight(10, unitOfMass.kg));

    facade.putRobot(board, 7, 15, robot1);
    facade.putRobot(board, 10, 13, robot2);
    facade.pickUpBattery(robot1, battery);

    facade.moveNextTo(robot1, robot2);

    assertTrue(robot1.getPosition().equals(Position.newPosition(9, 15, board)));
    assertTrue(robot2.getPosition().equals(Position.newPosition(10, 15, board)));
    assertEquals(3900, robot1.getAmountOfEnergy(), epsilon);
    assertEquals(0, robot2.getAmountOfEnergy(), epsilon);
  }
Esempio n. 8
0
  @Test
  public void testMoveStep() {
    robot = new Robot(new Energy(2400, unitOfPower.Ws), Orientation.RIGHT);
    robot.setPosition(Position.newPosition(3, 4, board));

    Program moveProgram = new Program(move, robot);
    robot.setProgram(moveProgram);

    assertEquals(1, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(5, 4, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(2400, robot.getAmountOfEnergy(), epsilon);

    moveProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(5, 4, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(1900, robot.getAmountOfEnergy(), epsilon);

    moveProgram.step();
    moveProgram.step();
    moveProgram.step();
    moveProgram.step();
    moveProgram.step();
    moveProgram.step();
    moveProgram.step();
    moveProgram.step();
    moveProgram.step();
    moveProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(5, 4, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(1900, robot.getAmountOfEnergy(), epsilon);
  }
Esempio n. 9
0
  @Test
  public void testShoot() {
    Board board = facade.createBoard(35, 47);
    Energy enoughEnergy = new Energy(5000, unitOfPower.Ws);
    Energy enoughEnergy2 = new Energy(5000, unitOfPower.Ws);
    Energy notEnoughEnergy = new Energy(500, unitOfPower.Ws);
    Robot robotEnoughEnergy = new Robot(enoughEnergy, Orientation.RIGHT);
    Robot robotNotEnoughEnergy = new Robot(notEnoughEnergy, Orientation.LEFT);
    Robot robotShootAtBoardEdge = new Robot(enoughEnergy2, Orientation.LEFT);
    Position positionRobotEnoughEnergy = Position.newPosition(0, 0, board);
    Position positionRobotNotEnoughEnergy = Position.newPosition(20, 0, board);
    Position positionRobotShootAtBoardEdge = Position.newPosition(3, 2, board);

    robotEnoughEnergy.setPosition(positionRobotEnoughEnergy);
    robotNotEnoughEnergy.setPosition(positionRobotNotEnoughEnergy);
    robotShootAtBoardEdge.setPosition(positionRobotShootAtBoardEdge);

    assertTrue(positionRobotEnoughEnergy.equals(robotEnoughEnergy.getPosition()));

    try {
      facade.shoot(robotNotEnoughEnergy);
    } catch (AssertionError ae) {
      System.err.println("testShoot(facadetest): This assertionerror is to be expected.");
    }

    assertTrue(positionRobotEnoughEnergy.equals(robotEnoughEnergy.getPosition()));
    assertTrue(positionRobotNotEnoughEnergy.equals(robotNotEnoughEnergy.getPosition()));
    assertEquals(
        notEnoughEnergy.getAmountOfEnergy(), robotNotEnoughEnergy.getAmountOfEnergy(), epsilon);
    assertEquals(enoughEnergy.getAmountOfEnergy(), robotEnoughEnergy.getAmountOfEnergy(), epsilon);

    facade.shoot(robotEnoughEnergy);

    assertTrue(positionRobotEnoughEnergy.equals(robotEnoughEnergy.getPosition()));
    assertEquals(
        notEnoughEnergy.getAmountOfEnergy(), robotNotEnoughEnergy.getAmountOfEnergy(), epsilon);
    assertEquals(16000, robotNotEnoughEnergy.getMaxEnergy().getAmountOfEnergy(), epsilon);
    assertEquals(4000, robotEnoughEnergy.getAmountOfEnergy(), epsilon);

    facade.shoot(robotShootAtBoardEdge);

    assertEquals(4000, robotShootAtBoardEdge.getAmountOfEnergy(), epsilon);
  }
Esempio n. 10
0
  @Test
  public void testGetBatteryY() {
    Board board = facade.createBoard(7, 16);
    Position position = Position.newPosition(3, 5, board);
    Battery battery = facade.createBattery(1000, 50);

    try {
      facade.getBatteryY(battery);
    } catch (IllegalStateException e) {
      System.err.println("testGetBatteryY: This illegalStateException is " + "to be expected.");
    }

    facade.putBattery(board, 3, 5, battery);
    assertEquals(position.Y, facade.getBatteryY(battery));
  }
Esempio n. 11
0
  @Test
  public void testGetRepairKitX() {
    Board board = facade.createBoard(7, 16);
    Position position = Position.newPosition(3, 5, board);
    RepairKit repairKit = facade.createRepairKit(1000, 50);

    try {
      facade.getRepairKitX(repairKit);
    } catch (IllegalStateException e) {
      System.err.println("testGetRepairKitX: This illegalStateException is " + "to be expected.");
    }

    facade.putRepairKit(board, 3, 5, repairKit);

    assertEquals(position.X, facade.getRepairKitX(repairKit));
  }
Esempio n. 12
0
  @Test
  public void testGetWallY() {
    Board board = facade.createBoard(7, 16);
    Position position = Position.newPosition(3, 5, board);
    Wall wall = facade.createWall();

    try {
      facade.getWallY(wall);
    } catch (IllegalStateException e) {
      System.err.println("testGetWallX: This illegalStateException is " + "to be expected.");
    }

    facade.putWall(board, 3, 5, wall);

    assertEquals(position.Y, facade.getWallY(wall));
  }
Esempio n. 13
0
  @Test
  public void testGetSurpriseBoxY() {
    Board board = facade.createBoard(7, 16);
    Position position = Position.newPosition(3, 5, board);
    SurpriseBox surpriseBox = facade.createSurpriseBox(1000);

    try {
      facade.getSurpriseBoxY(surpriseBox);
    } catch (IllegalStateException e) {
      System.err.println("testGetSurpriseBoxY: This illegalStateException is " + "to be expected.");
    }

    facade.putSurpriseBox(board, 3, 5, surpriseBox);

    assertEquals(position.Y, facade.getSurpriseBoxY(surpriseBox));
  }
Esempio n. 14
0
  @Test
  public void testGetRobotY() {
    Board board = facade.createBoard(7, 16);
    Position position = Position.newPosition(3, 5, board);
    Robot robot = facade.createRobot(0, 500);

    try {
      facade.getRobotY(robot);
    } catch (IllegalStateException e) {
      System.err.println("testGetRobotX: This illegalStateException is" + "to be expected.");
    }

    facade.putRobot(board, 3, 5, robot);

    assertEquals(position.Y, facade.getRobotY(robot));
  }
Esempio n. 15
0
  @Test
  public void testCowboyStep() {
    robot = new Robot(new Energy(15700, unitOfPower.Ws), Orientation.RIGHT);
    robot.setPosition(Position.newPosition(3, 4, board));
    board.putElement(
        Position.newPosition(3, 2, board),
        new Robot(new Energy(5000, unitOfPower.Ws), Orientation.LEFT));
    board.putElement(
        Position.newPosition(5, 4, board),
        new Robot(new Energy(5000, unitOfPower.Ws), Orientation.LEFT));
    board.putElement(
        Position.newPosition(3, 6, board),
        new Robot(new Energy(5000, unitOfPower.Ws), Orientation.LEFT));

    Program cowboyProgram = new Program(cowboy, robot);
    robot.setProgram(cowboyProgram);

    assertEquals(4, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(15700, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(4, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(14700, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(4, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(13700, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(4, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(12700, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(4, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(11700, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(3, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(10700, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(3, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(10600, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(3, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(9600, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(3, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(8600, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(3, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(7600, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(3, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(6600, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(2, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(5600, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(2, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.LEFT, robot.getOrientation());
    assertEquals(5500, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();

    assertEquals(2, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.UP, robot.getOrientation());
    assertEquals(5400, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();

    assertEquals(1, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.UP, robot.getOrientation());
    assertEquals(400, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();

    assertEquals(1, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.UP, robot.getOrientation());
    assertEquals(0, robot.getAmountOfEnergy(), epsilon);

    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();
    cowboyProgram.step();

    assertEquals(1, board.getElementsOf(Robot.class).size());
    assertEquals(Orientation.UP, robot.getOrientation());
    assertEquals(0, robot.getAmountOfEnergy(), epsilon);
  }
Esempio n. 16
0
  @Test
  public void testWhileInSeqStep() {
    robot = new Robot(new Energy(2400, unitOfPower.Ws), Orientation.RIGHT);
    robot.setPosition(Position.newPosition(3, 4, board));

    Program whileInSeqProgram = new Program(whileinseq, robot);
    robot.setProgram(whileInSeqProgram);

    assertEquals(1, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(5, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(6, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(7, 4, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(2400, robot.getAmountOfEnergy(), epsilon);

    whileInSeqProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(5, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(6, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(7, 4, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(1900, robot.getAmountOfEnergy(), epsilon);

    whileInSeqProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(5, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(6, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(7, 4, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(1400, robot.getAmountOfEnergy(), epsilon);

    whileInSeqProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(5, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(6, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(7, 4, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(900, robot.getAmountOfEnergy(), epsilon);

    whileInSeqProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(5, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(6, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(7, 4, board).getElements().size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(800, robot.getAmountOfEnergy(), epsilon);

    whileInSeqProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(5, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(6, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(7, 4, board).getElements().size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(800, robot.getAmountOfEnergy(), epsilon);

    whileInSeqProgram.step();
    whileInSeqProgram.step();
    whileInSeqProgram.step();
    whileInSeqProgram.step();
    whileInSeqProgram.step();
    whileInSeqProgram.step();
    whileInSeqProgram.step();
    whileInSeqProgram.step();
    whileInSeqProgram.step();
    whileInSeqProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(5, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(6, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(7, 4, board).getElements().size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(800, robot.getAmountOfEnergy(), epsilon);
  }
Esempio n. 17
0
  @Test
  public void testMoveNextToObstacles() {
    Board board = facade.createBoard(35, 47);
    Robot robot1 = facade.createRobot(0, 6600);
    Robot robot2 = facade.createRobot(0, 1800);

    facade.putRobot(board, 5, 5, robot1);
    facade.putRobot(board, 15, 5, robot2);

    Set<Position> maze = new HashSet<Position>();
    for (long x = 3; x < 18; x++) {
      maze.add(Position.newPosition(x, 3, board));
      maze.add(Position.newPosition(x, 7, board));
    }
    for (long y = 4; y < 7; y++) {
      maze.add(Position.newPosition(3, y, board));
      maze.add(Position.newPosition(17, y, board));
    }
    maze.add(Position.newPosition(7, 4, board));
    maze.add(Position.newPosition(7, 5, board));
    maze.add(Position.newPosition(10, 5, board));
    maze.add(Position.newPosition(10, 6, board));
    maze.add(Position.newPosition(13, 4, board));
    maze.add(Position.newPosition(13, 5, board));

    for (Position position : maze) {
      board.putElement(position, new Wall());
    }

    facade.moveNextTo(robot1, robot2);

    assertTrue(robot1.getPosition().equals(Position.newPosition(12, 6, board)));
    assertTrue(robot2.getPosition().equals(Position.newPosition(13, 6, board)));
    assertEquals(0, robot1.getAmountOfEnergy(), epsilon);
    assertEquals(0, robot2.getAmountOfEnergy(), epsilon);
  }
Esempio n. 18
0
  @Test
  public void testExampleInOneLineStep() {
    robot = new Robot(new Energy(3900, unitOfPower.Ws), Orientation.RIGHT);
    robot.setPosition(Position.newPosition(3, 4, board));

    Program exampleInOneLineProgram = new Program(example, robot);
    robot.setProgram(exampleInOneLineProgram);

    assertEquals(1, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(3900, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(3400, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(3300, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(2800, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.LEFT, robot.getOrientation());
    assertEquals(2700, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(1, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.LEFT, robot.getOrientation());
    assertEquals(2200, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(1, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.UP, robot.getOrientation());
    assertEquals(2100, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(1, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.UP, robot.getOrientation());
    assertEquals(1600, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(1, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(1500, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.RIGHT, robot.getOrientation());
    assertEquals(1000, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(900, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();
    exampleInOneLineProgram.step();
    exampleInOneLineProgram.step();
    exampleInOneLineProgram.step();
    exampleInOneLineProgram.step();
    exampleInOneLineProgram.step();
    exampleInOneLineProgram.step();
    exampleInOneLineProgram.step();
    exampleInOneLineProgram.step();
    exampleInOneLineProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(900, robot.getAmountOfEnergy(), epsilon);

    exampleInOneLineProgram.step();

    assertEquals(0, Position.newPosition(3, 4, board).getElements().size());
    assertEquals(1, Position.newPosition(4, 4, board).getElements().size());
    assertEquals(0, Position.newPosition(4, 5, board).getElements().size());
    assertEquals(0, Position.newPosition(3, 5, board).getElements().size());
    assertEquals(Orientation.DOWN, robot.getOrientation());
    assertEquals(900, robot.getAmountOfEnergy(), epsilon);
  }