public bool ProverkaNeighbout(koordinati other) { if (row == other.row && (col == other.col + 1 || col == other.col - 1)) { return(true); } if ((row == other.row + 1 || row == other.row - 1) && col == other.col) { return(true); } return(false); }
public bool ProverkaNeighbout(koordinati other) { if (row==other.row && (col==other.col+1||col==other.col-1)) { return true; } if ((row==other.row+1||row==other.row-1) && col==other.col) { return true; } return false; }
private static void TryToMoveNumber(int numberToMove) { if (numberPositions[0].ProverkaNeighbout(numberPositions[numberToMove])) { koordinati temp = numberPositions[0]; numberPositions[0] = numberPositions[numberToMove]; numberPositions[numberToMove] = temp; pole[numberPositions[numberToMove].Row, numberPositions[numberToMove].Col] = numberToMove; pole[numberPositions[0].Row, numberPositions[0].Col] = 0; } else { Console.WriteLine("Illegal command!"); } }