package ru.job4j.figure;

import ru.job4j.game.*;

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

public class Knight extends Figure {

    /**.
     * Constructor for class Knight
     * @param cellPosition is position figure
     */
    public Knight(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 {

		Cell[] cell = new Cell[1];

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

		if (disRow == srcRow + 2 && disCol == srcCol - 1) {
			cell[0] = new Cell(disRow, disCol);
		} else if (disRow == srcRow + 2 && disCol == srcCol + 1) {
			cell[0] = new Cell(disRow, disCol);
		} else if (disRow == srcRow + 1 && disCol == srcCol + 2) {
			cell[0] = new Cell(disRow, disCol);
		} else if (disRow == srcRow - 1 && disCol == srcCol + 2) {
			cell[0] = new Cell(disRow, disCol);
		} else if (disRow == srcRow - 2 && disCol == srcCol + 1) {
			cell[0] = new Cell(disRow, disCol);
		} else if (disRow == srcRow - 2 && disCol == srcCol - 1) {
			cell[0] = new Cell(disRow, disCol);
		} else if (disRow == srcRow + 1 && disCol == srcCol - 2) {
			cell[0] = new Cell(disRow, disCol);
		} else if (disRow == srcRow - 1 && disCol == srcCol - 2) {
			cell[0] = new Cell(disRow, disCol);
		} else {
			throw new ImposibleMoveException("incorrect choise cell");
		}
		return cell;
	}
}
@@ -763,750 +763,138 @@
 if (
-disRow == srcRow + 2 && disCol == srcCol - 1) %7B%0A%09%09%09cell%5B0%5D = new Cell(disRow, disCol);%0A%09%09%7D else if (disRow == srcRow + 2 && disCol == srcCol + 1) %7B%0A%09%09%09cell%5B0%5D = new Cell(disRow, disCol);%0A%09%09%7D else if (disRow == srcRow + 1 && disCol == srcCol + 2) %7B%0A%09%09%09cell%5B0%5D = new Cell(disRow, disCol);%0A%09%09%7D else if (disRow == srcRow - 1 && disCol == srcCol + 2) %7B%0A%09%09%09cell%5B0%5D = new Cell(disRow, disCol);%0A%09%09%7D else if (disRow == srcRow - 2 && disCol == srcCol + 1) %7B%0A%09%09%09cell%5B0%5D = new Cell(disRow, disCol);%0A%09%09%7D else if (disRow == srcRow - 2 && disCol == srcCol - 1) %7B%0A%09%09%09cell%5B0%5D = new Cell(disRow, disCol);%0A%09%09%7D else if (disRow == srcRow + 1 && disCol == srcCol - 2) %7B%0A%09%09%09cell%5B0%5D = new Cell(disRow, disCol);%0A%09%09%7D else if (disRow == srcRow - 1 && disCol == srcCol -
+Math.abs(srcRow - disRow) == 2 && Math.abs(srcCol - disCol) == 1 %7C%7C Math.abs(srcRow - disRow) == 1 && Math.abs(srcCol - disCol) ==
  2) 

add file for chapter_002_2.9.2