@Test
	public void testPlayerCapturesTwoFlagsAndOnePlayerBoxedIn() throws InvalidActionException {
		final GameEnded gameEnded = new GameEnded();
		
		game.addEventListener(new Listener() {
			
			@Override
			public void handleEvent(Event event) {
				if(event.getType() == EventType.END_GAME)
					gameEnded.setToTrue();
			}
		}, EventType.END_GAME);
		
		// Player 1 moves 4 up
		game.moveAction(Direction.UP);
		game.moveAction(Direction.UP);
		game.moveAction(Direction.UP);
		game.moveAction(Direction.UP);
		
		// Player 2 moves 4 down
		game.moveAction(Direction.DOWN);
		game.moveAction(Direction.DOWN);
		game.moveAction(Direction.DOWN);
		game.moveAction(Direction.DOWN);
		
		// Player 3 moves 4 right
		game.moveAction(Direction.RIGHT);
		game.moveAction(Direction.RIGHT);
		game.moveAction(Direction.RIGHT);
		game.moveAction(Direction.RIGHT);
		
		// Player 4 moves 4 up
		game.moveAction(Direction.UP);
		game.moveAction(Direction.UP);
		game.moveAction(Direction.UP);
		game.moveAction(Direction.UP);
		
		// Player 1 moves 4 up
		game.moveAction(Direction.UP);
		game.moveAction(Direction.UP);
		game.moveAction(Direction.UP);
		game.moveAction(Direction.UP);
		
		// Player 2 boxes in Player 4
		game.moveAction(Direction.LEFTDOWN);
		game.moveAction(Direction.DOWN);
		game.endTurnAction();
		
		// Player 3 moves 1 right
		game.moveAction(Direction.RIGHT);
		game.endTurnAction();
		
		// Player 1 picks up flag of Player 3
		game.moveAction(Direction.UP);
		game.pickUpAction(0);
		game.moveAction(Direction.RIGHTDOWN);
		game.moveAction(Direction.DOWN);
		
		// Player 2 moves 1 right
		game.moveAction(Direction.RIGHT);
		game.endTurnAction();
		
		// Player 3 moves 1 right
		game.moveAction(Direction.RIGHT);
		game.endTurnAction();
		
		// Player 1 moves 4 down
		game.moveAction(Direction.DOWN);
		game.moveAction(Direction.DOWN);
		game.moveAction(Direction.DOWN);
		game.moveAction(Direction.DOWN);
		
		// Player 2 moves 1 up
		game.moveAction(Direction.UP);
		game.endTurnAction();
		
		// Player 3 moves 1 down
		game.moveAction(Direction.DOWN);
		game.endTurnAction();
		
		// Player 1 captures flag and teleports
		game.moveAction(Direction.LEFTDOWN);
		game.moveAction(Direction.DOWN);
		game.moveAction(Direction.DOWN);
		game.moveAction(Direction.RIGHTUP);
		
		// Player 2 moves 1 up
		game.moveAction(Direction.UP);
		game.endTurnAction();
		
		// Player 3 moves 1 left
		game.moveAction(Direction.LEFT);
		game.endTurnAction();
		
		// Player 1 moves 4 right up
		game.moveAction(Direction.RIGHTUP);
		game.moveAction(Direction.RIGHTUP);
		game.moveAction(Direction.RIGHTUP);
		game.moveAction(Direction.RIGHTUP);
		
		// Player 2 moves 1 left down
		game.moveAction(Direction.LEFTDOWN);
		game.endTurnAction();
		
		// Player 3 moves 1 left
		game.moveAction(Direction.LEFT);
		game.endTurnAction();
		
		// Player 1 picks up flag of Player 2 and moves 2 left down
		game.moveAction(Direction.UP);
		game.pickUpAction(0);
		game.moveAction(Direction.LEFTDOWN);
		game.moveAction(Direction.LEFTDOWN);
		
		// Player 2 moves 1 down
		game.moveAction(Direction.DOWN);
		game.endTurnAction();
		
		// Player 3 moves 1 up
		game.moveAction(Direction.UP);
		game.endTurnAction();
		
		// Player 1 moves 4 left down
		game.moveAction(Direction.LEFTDOWN);
		game.moveAction(Direction.LEFTDOWN);
		game.moveAction(Direction.LEFTDOWN);
		game.moveAction(Direction.LEFTDOWN);
		
		// Player 2 moves 1 down
		game.moveAction(Direction.DOWN);
		game.endTurnAction();
		
		// Player 3 moves 1 up
		game.moveAction(Direction.RIGHT);
		game.endTurnAction();
		
		// Player 1 captures flag
		game.moveAction(Direction.LEFTDOWN);
		game.moveAction(Direction.LEFT);
		game.moveAction(Direction.LEFTDOWN);
		game.moveAction(Direction.DOWN);
		
		assertTrue(gameEnded.isTrue);
	}