private void MoveTo(int i = 0, int j = 0) { if (i > 0) { if (InCell.I + i >= _board.Cells.GetLength(0)) { return; } } if (j > 0) { if (InCell.J + j >= _board.Cells.GetLength(1)) { return; } } if (i < 0) { if (InCell.I + i < 0) { return; } } if (j < 0) { if (InCell.J + j < 0) { return; } } AvalableCellsForMove.Add(_board.Cells[InCell.I + i, InCell.J + j]); }
private void MoveTo(int i = 0, int j = 0) { _isFirstStep = false; if (InCell.I + i >= _board.Cells.GetLength(0) || InCell.I + i < 0) { return; } if (InCell.J + j >= _board.Cells.GetLength(1) || InCell.J + j < 0) { return; } if (i == j || i == -j) { if (!_board.Cells[InCell.I + i, InCell.J + j].IsFree()) { AvalableCellsForMove.Add(_board.Cells[InCell.I + i, InCell.J + j]); } } else { if (_board.Cells[InCell.I + i, InCell.J + j].IsFree()) { AvalableCellsForMove.Add(_board.Cells[InCell.I + i, InCell.J + j]); } } }
private void MoveTo(int i = 0, int j = 0) { _isFirstStep = false; if (InCell.I + i >= _board.Cells.GetLength(0) || InCell.I + i < 0) { return; } if (InCell.J + j >= _board.Cells.GetLength(1) || InCell.J + j < 0) { return; } AvalableCellsForMove.Add(_board.Cells[InCell.I + i, InCell.J + j]); }
private void MoveTo(int i, int j) { if (InCell.I + i >= _board.Cells.GetLength(0) || InCell.I + i < 0) { return; } if (InCell.J + j >= _board.Cells.GetLength(1) || InCell.J + j < 0) { return; } for (int _i = InCell.I + i, _j = InCell.J + j; 0 < _i && _i < _board.Cells.GetLength(0) && 0 < _j && _j < _board.Cells.GetLength(0); _i += i, _j += j) { AvalableCellsForMove.Add(_board.Cells[_i, _j]); if (!_board.Cells[_i, _j].IsFree()) { break; } } }