@@ -0,0 +1,1343 @@
+package ru.job4j.figure;%0A%0Aimport ru.job4j.game.*;%0A%0A/**.%0A* Chapter_002%0A* Task 2.9.2%0A* Create class King%0A*%0A* @author Anton Vasilyuk%0A* @version 1.0%0A* @since 0.1%0A*/%0A%0Apublic class King extends Figure %7B%0A%0A    /**.%0A     * Constructor for class King%0A     * @param cellPosition is position figure%0A     */%0A    public King(Cell cellPosition) %7B%0A        super(cellPosition);%0A    %7D%0A%0A%09/**.%0A%09* Method for check may be way figure%0A%09* @dist finish cell way%0A%09* @return array cell is way figure%0A%09*/%0A%09@Override%0A%09public Cell%5B%5D way(Cell dist) throws ImposibleMoveException %7B%0A%0A%09%09Board board = new Board();%0A%09%09Cell%5B%5D cell = new Cell%5B1%5D;%0A%09%09board.fillFigure();%0A%0A        int srcRow = this.cellPosition.getRow();%0A        int srcCol = this.cellPosition.getCol();%0A        int disRow = dist.getRow();%0A        int disCol = dist.getCol();%0A%0A%09%09if (srcRow == disRow && srcCol == disCol) %7B%0A%09%09%09throw new ImposibleMoveException(%22It cell is busy, make outher choice%22);%0A        %7D%0A%0A%09%09if (disRow %3E 7 %7C%7C disRow %3C 0 %7C%7C disCol %3E 7 %7C%7C disCol %3C 0) %7B%0A            throw new ImposibleMoveException(%22incorrect choice, change outher cell%22);%0A        %7D%0A%0A%09%09if (srcRow == disRow %7C%7C srcCol == disCol %7C%7C Math.abs(disRow - srcRow) == Math.abs(disCol - srcCol)) %7B%0A%09%09%09cell = routing(srcRow, srcCol, disRow, disCol);%0A%09%09%7D else %7B%0A%09%09%09throw new ImposibleMoveException(%22don't right choise%22);%0A%09%09%7D%0A%09%09return cell;%0A%09%7D%0A%7D

add file for chapter_002_2.9.2