@@ -0,0 +1,1932 @@
+/*%0A * Copyright (c) 2015. Shen Yichen %3C2007.yichen@gmail.com%3E%0A * Under The MIT License.%0A */%0A%0Apackage battleships.controller;%0A%0Aimport battleships.model.BasicShip;%0Aimport battleships.model.Board;%0Aimport battleships.model.IndependentBoard;%0Aimport battleships.model.Ship;%0Aimport java.util.LinkedHashMap;%0Aimport java.util.Map;%0A%0A/**%0A * The controller class for %7B@code CommandCenter%7D.%0A * %3Cp%3E%0A * This class links up the GUI to the board objects models.%0A * %3Cp%3E%0A * @author Shen Yichen %3C2007.yichen@gmail.com%3E%0A * @since v1.0.0%0A * @see battleships.gui.CommandCenter%0A */%0Apublic class CommandCenterController %7B%0A%0A    /**%0A     * The game board.%0A     */%0A    private final Board board;%0A    /**%0A     * The ships on the game board.%0A     * %3Cp%3E%0A     * Each ship has a name to identify it.%0A     */%0A    private final Map%3CString, Ship%3E ships;%0A%0A    /**%0A     * Creates a standard battleship game.%0A     * %3Cp%3E%0A     * A standard game comprises of a 10x10 board with the following ships:%0A     * %3Cul%3E%0A     * %3Cli%3EAircraft Carrier (1x5)%0A     * %3Cli%3EBattleship (1x4)%0A     * %3Cli%3ESubmarine (1x3)%0A     * %3Cli%3ECruiser (1x3)%0A     * %3Cli%3EDestroyer (1x2)%0A     * %3C/ul%3E%0A     */%0A    public CommandCenterController() %7B%0A        board = new IndependentBoard(10, 10);%0A%0A        ships = new LinkedHashMap%3C%3E();%0A%0A        int%5B%5D shipSizes = %7B5, 4, 3, 3, 2%7D;%0A        String%5B%5D shipNames = %7B%22Aircraft carrier%22, %22Battleship%22, %22Submarine%22, %22Cruiser%22, %22Destroyer%22%7D;%0A%0A        for (int i = 0; i %3C shipNames.length; i++) %7B%0A            Ship newShip = new BasicShip();%0A%0A            for (int j = 0; j %3C shipSizes%5Bi%5D; j++) %7B%0A                newShip.addSquare(0, j);%0A            %7D%0A            board.addShip(newShip);%0A            ships.put(shipNames%5Bi%5D, newShip);%0A        %7D%0A    %7D%0A%0A    public int getBoardHeight() %7B%0A        return board.getHeight();%0A    %7D%0A%0A    public int getBoardWidth() %7B%0A        return board.getWidth();%0A    %7D%0A%0A    //TODO implment the rest of the methods%0A    //Use a cache for results%0A%7D%0A

Add controller