package ru.job4j.figure;

import ru.job4j.game.*;

/**.
* Chapter_002
* Task 2.9.2
* Create class Bishop
*
* @author Anton Vasilyuk
* @version 1.0
* @since 0.1
*/

public class Bishop extends Figure {

    /**.
     * Constructor for class Bishop
     * @param cellPosition is position figure
     */
    public Bishop(Cell cellPosition) {
        super(cellPosition);
    }

	/**.
	* Method for check may be way figure
	* @dist finish cell way
	* @return array cell is way figure
	*/
	@Override
	public Cell[] way(Cell dist) throws ImposibleMoveException {

		Board board = new Board();
		Cell[] cell;
		board.fillFigure();

        int srcRow = this.cellPosition.getRow();
        int srcCol = this.cellPosition.getCol();
        int disRow = dist.getRow();
        int disCol = dist.getCol();

		if (srcRow == disRow && srcCol == disCol) {
			throw new ImposibleMoveException("It cell is busy, make outher choice");
        }

		if (disRow > 7 || disRow < 0 || disCol > 7 || disCol < 0) {
            throw new ImposibleMoveException("incorrect choice, change outher cell");
        }

		if (Math.abs(disRow - srcRow) != Math.abs(disCol - srcCol)) {
			throw new ImposibleMoveException("this figure don't can go to the cell");
		}
		if (Math.abs(disRow - srcRow) == Math.abs(disCol - srcCol)) {
			cell = routing(srcRow, srcCol, disRow, disCol);
		} else {
			throw new ImposibleMoveException("don't right choise");
		}
		return cell;
	}
}
@@ -558,70 +558,19 @@
 %0A%0A%09%09
-Board board = new Board();%0A%09%09Cell%5B%5D cell;%0A%09%09board.fillFigure()
+Cell%5B%5D cell
 ;%0A%0A 
@@ -694,32 +694,32 @@
  dist.getRow();%0A
+
         int disC
@@ -743,300 +743,8 @@
 );%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

add file for chapter_002_2.9.2