////////////////////////////////////////
// Programming project code
// UniBw M, 2022, 2023, 2024
// www.unibw.de/inf2
// (c) Mark Minas (mark.minas@unibw.de)
////////////////////////////////////////

package pp.battleship.game.client;

import org.junit.Test;
import pp.battleship.BattleshipConfig;
import pp.battleship.message.client.MapMessage;
import pp.battleship.message.client.ShootMessage;
import pp.battleship.message.server.EffectMessage;
import pp.battleship.message.server.GameDetails;
import pp.battleship.message.server.StartBattleMessage;
import pp.battleship.model.Battleship;

import java.util.List;
import java.util.Properties;

import static org.junit.Assert.assertEquals;
import static pp.battleship.model.Battleship.Status.NORMAL;
import static pp.battleship.model.Battleship.Status.VALID_PREVIEW;
import static pp.battleship.model.Rotation.DOWN;
import static pp.battleship.model.Rotation.RIGHT;

/**
 * Integration test cases for the client game logic of Player 2 in a larger game, called "Game 2".
 * The test cases for Player 1 are contained in {@linkplain ClientGame2Player1Test}
 * and the test cases for the server in {@linkplain pp.battleship.game.server.ServerGame2Test}.
 *
 * @see ClientGame2Player1Test
 * @see pp.battleship.game.server.ServerGame2Test
 */
public class ClientGame2Player2Test extends AbstractClientGameTest {
    @Test
    public void testClient() {
        BattleshipConfig config;
        Properties props;
        List<Battleship> ships;
        MapMessage mapMsg;
        ShootMessage shootMsg;

        config = new BattleshipConfig();
        props = new Properties();
        props.setProperty("map.width", "10");
        props.setProperty("map.height", "10");
        props.setProperty("ship.nums", "4,3,2,1");
        config.readFrom(props);
        clientLogic.received(new GameDetails(config));
        assertEquals("place.ships.in.your.map", infoTexts.poll());
        clientLogic.clickHarbor(p(1, 9));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 4, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, NORMAL);
        checkShip(ships.get(8), 3, 0, 8, RIGHT, NORMAL);
        checkShip(ships.get(9), 4, 0, 9, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 4, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, NORMAL);
        checkShip(ships.get(8), 3, 0, 8, RIGHT, NORMAL);
        checkShip(ships.get(9), 4, 0, 9, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 8));
        clientLogic.movePreview(p(9, 8));
        clientLogic.movePreview(p(8, 8));
        clientLogic.movePreview(p(8, 8));
        clientLogic.movePreview(p(8, 8));
        clientLogic.movePreview(p(8, 8));
        clientLogic.movePreview(p(7, 8));
        clientLogic.movePreview(p(7, 8));
        clientLogic.movePreview(p(6, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, NORMAL);
        checkShip(ships.get(8), 3, 0, 8, RIGHT, NORMAL);
        checkShip(ships.get(9), 4, 0, 9, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(5, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, NORMAL);
        checkShip(ships.get(8), 3, 0, 8, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(0, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, NORMAL);
        checkShip(ships.get(8), 3, 0, 8, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, NORMAL);
        checkShip(ships.get(8), 3, 0, 8, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 7));
        clientLogic.movePreview(p(8, 7));
        clientLogic.movePreview(p(8, 7));
        clientLogic.movePreview(p(8, 7));
        clientLogic.movePreview(p(7, 7));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, NORMAL);
        checkShip(ships.get(8), 3, 0, 8, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(4, 6));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(8, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(0, 7));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(3, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(2), 3, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(8, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(3, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(2), 3, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(8, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 7));
        clientLogic.movePreview(p(8, 7));
        clientLogic.movePreview(p(8, 7));
        clientLogic.movePreview(p(7, 7));
        clientLogic.movePreview(p(7, 7));
        clientLogic.movePreview(p(6, 7));
        clientLogic.movePreview(p(6, 7));
        clientLogic.movePreview(p(6, 7));
        clientLogic.movePreview(p(6, 7));
        clientLogic.movePreview(p(5, 7));
        clientLogic.movePreview(p(5, 7));
        clientLogic.movePreview(p(5, 7));
        clientLogic.movePreview(p(5, 7));
        clientLogic.movePreview(p(5, 7));
        clientLogic.movePreview(p(5, 7));
        clientLogic.movePreview(p(5, 7));
        clientLogic.movePreview(p(4, 7));
        clientLogic.movePreview(p(4, 7));
        clientLogic.movePreview(p(3, 8));
        clientLogic.movePreview(p(3, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(3, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(2), 3, 1, 8, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(8, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 3, 0, 7, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(1, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(3, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(2), 3, 1, 8, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(7, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(0, 6));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(2), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(7, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(2), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(7, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 5));
        clientLogic.movePreview(p(9, 5));
        clientLogic.movePreview(p(7, 3));
        clientLogic.movePreview(p(5, 2));
        clientLogic.movePreview(p(5, 2));
        clientLogic.movePreview(p(5, 2));
        clientLogic.movePreview(p(5, 1));
        clientLogic.movePreview(p(4, 1));
        clientLogic.movePreview(p(4, 1));
        clientLogic.movePreview(p(4, 1));
        clientLogic.movePreview(p(4, 1));
        clientLogic.movePreview(p(4, 0));
        clientLogic.movePreview(p(3, 0));
        clientLogic.movePreview(p(3, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.rotateShip();
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(3, 1));
        clientLogic.movePreview(p(3, 1));
        clientLogic.movePreview(p(3, 2));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 4));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        clientLogic.movePreview(p(2, 6));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(2), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 2, 6, DOWN, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(7, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 0, 6, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(2, 6));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(2), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 2, 6, DOWN, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(6, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(2), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 2, 6, DOWN, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(6, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        clientLogic.clickOwnMap(p(4, 6));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 4, 6, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(7, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 3, 0, 6, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 5));
        clientLogic.movePreview(p(4, 5));
        clientLogic.movePreview(p(4, 5));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 3));
        clientLogic.movePreview(p(4, 3));
        clientLogic.movePreview(p(4, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 2));
        clientLogic.movePreview(p(3, 2));
        clientLogic.movePreview(p(3, 2));
        clientLogic.movePreview(p(3, 2));
        clientLogic.movePreview(p(3, 1));
        clientLogic.movePreview(p(3, 1));
        clientLogic.movePreview(p(3, 1));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.rotateShip();
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 0));
        clientLogic.movePreview(p(2, 1));
        clientLogic.movePreview(p(2, 1));
        clientLogic.movePreview(p(2, 1));
        clientLogic.movePreview(p(2, 2));
        clientLogic.movePreview(p(2, 2));
        clientLogic.movePreview(p(2, 2));
        clientLogic.movePreview(p(2, 2));
        clientLogic.movePreview(p(3, 2));
        clientLogic.movePreview(p(3, 2));
        clientLogic.movePreview(p(3, 2));
        clientLogic.movePreview(p(3, 2));
        clientLogic.movePreview(p(3, 2));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(3, 3));
        clientLogic.movePreview(p(2, 3));
        clientLogic.movePreview(p(2, 3));
        clientLogic.movePreview(p(2, 3));
        clientLogic.movePreview(p(2, 3));
        clientLogic.movePreview(p(2, 3));
        clientLogic.movePreview(p(2, 3));
        clientLogic.movePreview(p(2, 3));
        clientLogic.movePreview(p(2, 3));
        clientLogic.movePreview(p(2, 3));
        clientLogic.movePreview(p(2, 3));
        clientLogic.movePreview(p(2, 3));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(7, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        checkShip(ships.get(6), 3, 0, 6, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(2, 3));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(6, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(0, 5));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(5, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(6, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(5, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(6, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 5));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(5, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        clientLogic.movePreview(p(4, 6));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(5, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(6, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 5, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(4, 6));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(5, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(5, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(1, 4));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(6, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(5, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(6, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(5, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(8, 4));
        clientLogic.movePreview(p(8, 4));
        clientLogic.movePreview(p(8, 4));
        clientLogic.movePreview(p(8, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(6, 4));
        clientLogic.movePreview(p(6, 4));
        clientLogic.movePreview(p(6, 4));
        clientLogic.movePreview(p(6, 4));
        clientLogic.movePreview(p(6, 4));
        clientLogic.movePreview(p(6, 4));
        clientLogic.movePreview(p(5, 4));
        clientLogic.movePreview(p(5, 4));
        clientLogic.movePreview(p(5, 4));
        clientLogic.movePreview(p(5, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(4, 4));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(6, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(5, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 0, 4, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(4, 4));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(6, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(0, 3));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(7, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(7, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(9, 5));
        clientLogic.movePreview(p(8, 5));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 6));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(7, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(4, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        checkShip(ships.get(3), 1, 0, 3, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(7, 6));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(7, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(3, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(0, 2));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(8, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(3, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(8, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(3, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 3));
        clientLogic.movePreview(p(9, 3));
        clientLogic.movePreview(p(9, 3));
        clientLogic.movePreview(p(9, 3));
        clientLogic.movePreview(p(8, 3));
        clientLogic.movePreview(p(8, 3));
        clientLogic.movePreview(p(8, 3));
        clientLogic.movePreview(p(8, 3));
        clientLogic.movePreview(p(8, 3));
        clientLogic.movePreview(p(8, 3));
        clientLogic.movePreview(p(8, 3));
        clientLogic.movePreview(p(8, 3));
        clientLogic.movePreview(p(8, 3));
        clientLogic.movePreview(p(8, 3));
        clientLogic.movePreview(p(7, 3));
        clientLogic.movePreview(p(7, 3));
        clientLogic.movePreview(p(7, 3));
        clientLogic.movePreview(p(7, 3));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        clientLogic.movePreview(p(7, 4));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(8, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(3, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(2), 1, 0, 2, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(7, 4));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(8, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(0, 1));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 1));
        clientLogic.movePreview(p(9, 1));
        clientLogic.movePreview(p(9, 1));
        clientLogic.movePreview(p(8, 2));
        clientLogic.movePreview(p(8, 2));
        clientLogic.movePreview(p(7, 1));
        clientLogic.movePreview(p(7, 1));
        clientLogic.movePreview(p(6, 1));
        clientLogic.movePreview(p(6, 1));
        clientLogic.movePreview(p(6, 1));
        clientLogic.movePreview(p(6, 1));
        clientLogic.movePreview(p(6, 1));
        clientLogic.movePreview(p(5, 1));
        clientLogic.movePreview(p(5, 2));
        clientLogic.movePreview(p(5, 2));
        clientLogic.movePreview(p(5, 2));
        clientLogic.movePreview(p(5, 2));
        clientLogic.movePreview(p(5, 2));
        clientLogic.movePreview(p(5, 2));
        clientLogic.movePreview(p(4, 2));
        clientLogic.movePreview(p(4, 2));
        clientLogic.movePreview(p(4, 2));
        clientLogic.movePreview(p(4, 2));
        clientLogic.movePreview(p(4, 2));
        clientLogic.movePreview(p(4, 2));
        clientLogic.movePreview(p(4, 2));
        clientLogic.movePreview(p(4, 2));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 4, 2, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 0, 1, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(4, 2));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 4, 2, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(0, 0));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(9), 1, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(9), 1, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 0));
        clientLogic.movePreview(p(9, 1));
        clientLogic.movePreview(p(8, 1));
        clientLogic.movePreview(p(7, 1));
        clientLogic.movePreview(p(7, 1));
        clientLogic.movePreview(p(7, 2));
        clientLogic.movePreview(p(6, 2));
        clientLogic.movePreview(p(6, 2));
        clientLogic.movePreview(p(6, 2));
        clientLogic.movePreview(p(6, 2));
        clientLogic.movePreview(p(6, 2));
        clientLogic.movePreview(p(6, 2));
        clientLogic.movePreview(p(6, 2));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(9), 1, 6, 2, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 1, 0, 0, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(6, 2));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(9), 1, 6, 2, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(0, ships.size());
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 4, 5, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(2), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(4), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(9), 1, 6, 2, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(0, ships.size());
        clientLogic.clickOwnMap(p(5, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(2), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(3), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 6, 2, RIGHT, NORMAL);
        checkShip(ships.get(9), 4, 5, 8, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 4, 0, 0, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(5, 8));
        clientLogic.movePreview(p(6, 8));
        clientLogic.movePreview(p(6, 7));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(7, 5));
        clientLogic.movePreview(p(7, 5));
        clientLogic.movePreview(p(8, 4));
        clientLogic.movePreview(p(8, 4));
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(9, 3));
        clientLogic.movePreview(p(9, 3));
        clientLogic.movePreview(p(9, 3));
        clientLogic.movePreview(p(9, 2));
        clientLogic.clickHarbor(p(2, 3));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(2), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(3), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 6, 2, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 4, 0, 0, RIGHT, NORMAL);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(2), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(3), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 6, 2, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 4, 0, 0, RIGHT, NORMAL);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 3, 1, 8, RIGHT, NORMAL);
        checkShip(ships.get(1), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(2), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(3), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(4), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 6, 2, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 4, 0, 0, RIGHT, NORMAL);
        clientLogic.clickOwnMap(p(2, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 3, 2, 8, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 4, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 0, 1, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(3, 8));
        clientLogic.movePreview(p(4, 7));
        clientLogic.movePreview(p(5, 7));
        clientLogic.movePreview(p(5, 7));
        clientLogic.movePreview(p(6, 6));
        clientLogic.movePreview(p(7, 6));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(8, 5));
        clientLogic.movePreview(p(8, 5));
        clientLogic.movePreview(p(8, 5));
        clientLogic.movePreview(p(9, 5));
        clientLogic.movePreview(p(9, 5));
        clientLogic.movePreview(p(9, 5));
        clientLogic.movePreview(p(9, 5));
        clientLogic.clickHarbor(p(0, 5));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(8, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 4, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 0, 1, RIGHT, NORMAL);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(8, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 4, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(1), 3, 0, 1, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(1, 0));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 4, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(1), 4, 0, 0, RIGHT, VALID_PREVIEW);
        checkShip(ships.get(0), 3, 0, 1, RIGHT, NORMAL);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 4, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 3, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(1), 4, 0, 0, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 1));
        clientLogic.movePreview(p(7, 2));
        clientLogic.movePreview(p(5, 3));
        clientLogic.movePreview(p(4, 4));
        clientLogic.movePreview(p(3, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(2, 5));
        clientLogic.movePreview(p(1, 6));
        clientLogic.movePreview(p(1, 6));
        clientLogic.movePreview(p(0, 6));
        clientLogic.movePreview(p(0, 7));
        clientLogic.movePreview(p(0, 7));
        clientLogic.movePreview(p(0, 7));
        clientLogic.movePreview(p(0, 7));
        clientLogic.movePreview(p(0, 7));
        clientLogic.movePreview(p(0, 7));
        clientLogic.movePreview(p(0, 8));
        clientLogic.movePreview(p(0, 8));
        clientLogic.movePreview(p(0, 8));
        clientLogic.movePreview(p(0, 8));
        clientLogic.movePreview(p(0, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(1, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        clientLogic.movePreview(p(2, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 4, 2, 8, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 3, 0, 1, RIGHT, NORMAL);
        checkShip(ships.get(1), 4, 0, 0, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(2, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(9, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 4, 2, 8, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 3, 0, 1, RIGHT, NORMAL);
        clientLogic.clickHarbor(p(1, 1));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 4, 2, 8, RIGHT, NORMAL);
        checkShip(ships.get(9), 3, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 3, 0, 1, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 4, 2, 8, RIGHT, NORMAL);
        checkShip(ships.get(9), 3, 0, 0, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 3, 0, 1, RIGHT, VALID_PREVIEW);
        clientLogic.movePreview(p(9, 3));
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(9, 4));
        clientLogic.movePreview(p(8, 5));
        clientLogic.movePreview(p(8, 5));
        clientLogic.movePreview(p(8, 5));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(9, 6));
        clientLogic.movePreview(p(8, 6));
        clientLogic.movePreview(p(8, 7));
        clientLogic.movePreview(p(8, 7));
        clientLogic.movePreview(p(8, 7));
        clientLogic.movePreview(p(8, 7));
        clientLogic.movePreview(p(8, 7));
        clientLogic.movePreview(p(8, 8));
        clientLogic.movePreview(p(7, 8));
        clientLogic.movePreview(p(7, 8));
        clientLogic.movePreview(p(7, 8));
        clientLogic.movePreview(p(7, 8));
        clientLogic.movePreview(p(7, 8));
        clientLogic.movePreview(p(7, 8));
        clientLogic.movePreview(p(7, 8));
        clientLogic.movePreview(p(7, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 4, 2, 8, RIGHT, NORMAL);
        checkShip(ships.get(9), 3, 7, 8, RIGHT, VALID_PREVIEW);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 3, 0, 1, RIGHT, VALID_PREVIEW);
        clientLogic.clickOwnMap(p(7, 8));
        ships = clientLogic.getOwnMap().getRemainingShips();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(ships.get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(ships.get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(ships.get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(ships.get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(ships.get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(ships.get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 6, 2, RIGHT, NORMAL);
        checkShip(ships.get(8), 4, 2, 8, RIGHT, NORMAL);
        checkShip(ships.get(9), 3, 7, 8, RIGHT, NORMAL);
        ships = clientLogic.getHarbor().getRemainingShips();
        assertEquals(0, ships.size());
        clientLogic.mapFinished();
        mapMsg = (MapMessage) messages.poll();
        assertEquals(10, mapMsg.getShips().size());
        checkShip(mapMsg.getShips().get(0), 2, 2, 6, DOWN, NORMAL);
        checkShip(mapMsg.getShips().get(1), 3, 2, 3, DOWN, NORMAL);
        checkShip(mapMsg.getShips().get(2), 2, 4, 6, RIGHT, NORMAL);
        checkShip(mapMsg.getShips().get(3), 2, 4, 4, RIGHT, NORMAL);
        checkShip(mapMsg.getShips().get(4), 1, 7, 6, RIGHT, NORMAL);
        checkShip(mapMsg.getShips().get(5), 1, 7, 4, RIGHT, NORMAL);
        checkShip(mapMsg.getShips().get(6), 1, 4, 2, RIGHT, NORMAL);
        checkShip(mapMsg.getShips().get(7), 1, 6, 2, RIGHT, NORMAL);
        checkShip(mapMsg.getShips().get(8), 4, 2, 8, RIGHT, NORMAL);
        checkShip(mapMsg.getShips().get(9), 3, 7, 8, RIGHT, NORMAL);
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(new StartBattleMessage(false));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.clickOpponentMap(p(4, 5));
        assertEquals("wait.its.not.your.turn", infoTexts.poll());
        clientLogic.received(EffectMessage.miss(false, p(5, 5)));
        assertEquals("its.your.turn", infoTexts.poll());
        clientLogic.clickOpponentMap(p(5, 5));
        shootMsg = (ShootMessage) messages.poll();
        assertEquals(p(5, 5), shootMsg.getPosition());
        clientLogic.received(EffectMessage.miss(true, p(5, 5)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.hit(false, p(5, 6)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.miss(false, p(6, 6)));
        assertEquals("its.your.turn", infoTexts.poll());
        clientLogic.clickOpponentMap(p(5, 6));
        shootMsg = (ShootMessage) messages.poll();
        assertEquals(p(5, 6), shootMsg.getPosition());
        clientLogic.received(EffectMessage.miss(true, p(5, 6)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.shipDestroyed(false, p(4, 6), new Battleship(2, 4, 6, RIGHT)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.hit(false, p(4, 8)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.hit(false, p(5, 8)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.miss(false, p(6, 8)));
        assertEquals("its.your.turn", infoTexts.poll());
        clientLogic.clickOpponentMap(p(3, 7));
        shootMsg = (ShootMessage) messages.poll();
        assertEquals(p(3, 7), shootMsg.getPosition());
        clientLogic.received(EffectMessage.miss(true, p(3, 7)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.hit(false, p(3, 8)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.shipDestroyed(false, p(2, 8), new Battleship(4, 2, 8, RIGHT)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.clickOpponentMap(p(7, 7));
        assertEquals("wait.its.not.your.turn", infoTexts.poll());
        clientLogic.clickOpponentMap(p(7, 7));
        assertEquals("wait.its.not.your.turn", infoTexts.poll());
        clientLogic.received(EffectMessage.miss(false, p(0, 8)));
        assertEquals("its.your.turn", infoTexts.poll());
        clientLogic.clickOpponentMap(p(5, 9));
        shootMsg = (ShootMessage) messages.poll();
        assertEquals(p(5, 9), shootMsg.getPosition());
        clientLogic.received(EffectMessage.hit(true, p(5, 9)));
        assertEquals("its.your.turn", infoTexts.poll());
        clientLogic.clickOpponentMap(p(6, 9));
        shootMsg = (ShootMessage) messages.poll();
        assertEquals(p(6, 9), shootMsg.getPosition());
        clientLogic.received(EffectMessage.shipDestroyed(true, p(6, 9), new Battleship(2, 5, 9, RIGHT)));
        assertEquals("its.your.turn", infoTexts.poll());
        ships = clientLogic.getOpponentMap().getShips().toList();
        assertEquals(1, ships.size());
        checkShip(ships.get(0), 2, 5, 9, RIGHT, NORMAL);
        clientLogic.clickOpponentMap(p(7, 7));
        shootMsg = (ShootMessage) messages.poll();
        assertEquals(p(7, 7), shootMsg.getPosition());
        clientLogic.received(EffectMessage.miss(true, p(7, 7)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.miss(false, p(0, 6)));
        assertEquals("its.your.turn", infoTexts.poll());
        clientLogic.clickOpponentMap(p(2, 5));
        shootMsg = (ShootMessage) messages.poll();
        assertEquals(p(2, 5), shootMsg.getPosition());
        clientLogic.received(EffectMessage.miss(true, p(2, 5)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.hit(false, p(7, 8)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.hit(false, p(8, 8)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.shipDestroyed(false, p(9, 8), new Battleship(3, 7, 8, RIGHT)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.hit(false, p(2, 6)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.shipDestroyed(false, p(2, 5), new Battleship(2, 2, 6, DOWN)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.miss(false, p(3, 3)));
        assertEquals("its.your.turn", infoTexts.poll());
        clientLogic.clickOpponentMap(p(8, 9));
        shootMsg = (ShootMessage) messages.poll();
        assertEquals(p(8, 9), shootMsg.getPosition());
        clientLogic.received(EffectMessage.shipDestroyed(true, p(8, 9), new Battleship(1, 8, 9, RIGHT)));
        assertEquals("its.your.turn", infoTexts.poll());
        ships = clientLogic.getOpponentMap().getShips().toList();
        assertEquals(2, ships.size());
        checkShip(ships.get(0), 2, 5, 9, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 8, 9, RIGHT, NORMAL);
        clientLogic.clickOpponentMap(p(5, 3));
        shootMsg = (ShootMessage) messages.poll();
        assertEquals(p(5, 3), shootMsg.getPosition());
        clientLogic.received(EffectMessage.miss(true, p(5, 3)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.hit(false, p(2, 3)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.hit(false, p(2, 2)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.shipDestroyed(false, p(2, 1), new Battleship(3, 2, 3, DOWN)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.hit(false, p(4, 4)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.shipDestroyed(false, p(5, 4), new Battleship(2, 4, 4, RIGHT)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.shipDestroyed(false, p(7, 4), new Battleship(1, 7, 4, RIGHT)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.miss(false, p(9, 4)));
        assertEquals("its.your.turn", infoTexts.poll());
        clientLogic.clickOpponentMap(p(8, 4));
        shootMsg = (ShootMessage) messages.poll();
        assertEquals(p(8, 4), shootMsg.getPosition());
        clientLogic.received(EffectMessage.miss(true, p(8, 4)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.shipDestroyed(false, p(7, 6), new Battleship(1, 7, 6, RIGHT)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.shipDestroyed(false, p(4, 2), new Battleship(1, 4, 2, RIGHT)));
        assertEquals("wait.for.opponent", infoTexts.poll());
        clientLogic.received(EffectMessage.lost(p(6, 2), new Battleship(1, 6, 2, RIGHT), List.of(new Battleship(4, 0, 5, DOWN), new Battleship(3, 0, 9, DOWN), new Battleship(3, 0, 0, RIGHT), new Battleship(2, 4, 0, RIGHT), new Battleship(2, 2, 9, RIGHT), new Battleship(1, 7, 0, RIGHT), new Battleship(1, 9, 0, RIGHT), new Battleship(1, 9, 7, RIGHT))));
        assertEquals("you.lost.the.game", infoTexts.poll());
        ships = clientLogic.getOpponentMap().getShips().toList();
        assertEquals(10, ships.size());
        checkShip(ships.get(0), 2, 5, 9, RIGHT, NORMAL);
        checkShip(ships.get(1), 1, 8, 9, RIGHT, NORMAL);
        checkShip(ships.get(2), 4, 0, 5, DOWN, NORMAL);
        checkShip(ships.get(3), 3, 0, 9, DOWN, NORMAL);
        checkShip(ships.get(4), 3, 0, 0, RIGHT, NORMAL);
        checkShip(ships.get(5), 2, 4, 0, RIGHT, NORMAL);
        checkShip(ships.get(6), 2, 2, 9, RIGHT, NORMAL);
        checkShip(ships.get(7), 1, 7, 0, RIGHT, NORMAL);
        checkShip(ships.get(8), 1, 9, 0, RIGHT, NORMAL);
        checkShip(ships.get(9), 1, 9, 7, RIGHT, NORMAL);

        assertEquals(0, infoTexts.size());
        assertEquals(0, messages.size());
    }
}
