@@ -0,0 +1,2265 @@
+package by.vorokhobko.Chess.models;%0A%0Aimport by.vorokhobko.Chess.exceptions.FigureNotFoundException;%0Aimport by.vorokhobko.Chess.exceptions.ImposibleMoveException;%0Aimport by.vorokhobko.Chess.exceptions.OccupiedWayException;%0A%0A/**%0A * Board.%0A *%0A * Class Board performs the role of board in chess part 002, lesson test.%0A * @author Evgeny Vorokhobko (vorokhobko2011@yandex.ru).%0A * @since 13.05.2017.%0A * @version 1.%0A */%0Apublic class Board %7B%0A    /**%0A     * The class field.%0A     */%0A    private static final int NUMBER_OF_PIECES = 32;%0A    /**%0A     * The class field.%0A     */%0A    private Figure%5B%5D figures = new Figure%5BNUMBER_OF_PIECES%5D;%0A    /**%0A     * Method determining can move figure or not.%0A     * @param source - source.%0A     * @param dist - dist.%0A     * @throws ImposibleMoveException tag.%0A     * @throws OccupiedWayException tag.%0A     * @throws FigureNotFoundException tag.%0A     * @return tag.%0A     */%0A    public boolean move(Cell source, Cell dist) throws ImposibleMoveException, OccupiedWayException, FigureNotFoundException %7B%0A        boolean isNeedSave = false;%0A        Cell%5B%5D pass = null;%0A        for (Figure figure : figures) %7B%0A            if (figure != null && figure.getPosition().equals(source)) %7B%0A                pass = figure.way(dist);%0A                isNeedSave = true;%0A                break;%0A            %7D else %7B%0A                throw new ImposibleMoveException(%22Figure imposible move%22);%0A            %7D%0A        %7D%0A        if (!isNeedSave) %7B%0A            throw new FigureNotFoundException(%22Figure not found%22);%0A        %7D%0A        isNeedSave = false;%0A        for (Figure figure : figures) %7B%0A            for (Cell cellPass : pass) %7B%0A                if (cellPass != null && figure.getPosition().equals(cellPass)) %7B%0A                    isNeedSave = true;%0A                    break;%0A                %7D%0A            %7D%0A            if (isNeedSave) %7B%0A                break;%0A            %7D%0A        %7D%0A        if (!isNeedSave) %7B%0A            throw new OccupiedWayException(%22Figure occupied way%22);%0A        %7D%0A        for (int count = 0; count %3C figures.length; count++) %7B%0A            if (figures%5Bcount%5D != null && figures%5Bcount%5D.getPosition().equals(source)) %7B%0A                figures%5Bcount%5D = figures%5Bcount%5D.clone(dist);%0A            %7D%0A        %7D%0A        return isNeedSave;%0A    %7D%0A%7D

add classs Board