package ru.job4j.figure;

import ru.job4j.game.*;

/**.
* Chapter_002
* Task 2.9.2
* Interface for create figure
*
* @author Anton Vasilyuk
* @version 1.0
* @since 0.1
*/

public abstract class Figure {


    /**.
     * @cellPosition cellPosition the sell
     */
    protected final Cell cellPosition;

    /**.
     * Constructor
     * @param cellPosition is cell for new figure
     */
    public Figure(Cell cellPosition){
        this.cellPosition = cellPosition;
    }

    /**.
     * Getter for this cellPosition
     */
    public Cell getCell() {
        return this.cellPosition;
    }

    /**.
     * Abstract method building way for the figure
     * @param dist finish point
     * @return way array cells
     */
    public abstract Cell[] way(Cell dist) throws ImposibleMoveException;

}
@@ -798,9 +798,708 @@
 ption;%0A%0A
+%09public Cell%5B%5D routing(int srcRow, int srcCol, int disRow, int disCol) %7B%0A%09%09int positionRow = 0;%0A%09%09int positionCol = 0;%0A%09%09int line = 0;%0A%09%09if (srcRow == disRow) %7Bline = Math.abs(disCol - srcCol);%7D%0A%09%09if (srcCol == disCol) %7Bline = Math.abs(disRow - srcRow);%7D%0A%09%09if (Math.abs(disRow - srcRow) == Math.abs(disCol - srcRow)) %7Bline = Math.abs(disRow - srcRow);%7D%0A        Cell%5B%5D cells = new Cell%5Bline%5D;%0A%09%09int rMove = disRow %3E srcRow ? 1 : disRow %3C srcRow ? -1 : 0;%0A%09%09int cMove = disCol %3E srcCol ? 1 : disCol %3C srcCol ? -1 : 0;%0A%09%09for (int i = 0; i %3C line; i++) %7B%0A%09%09%09positionRow = positionRow + rMove;%0A%09%09%09positionCol = positionCol + cMove;%0A%09%09%09cells%5Bi%5D = new Cell(positionRow, positionCol);%0A%09%09%7D%0A%09return cells;%0A%09%7D%0A
 %7D

add file for chapter_002_2.9.2