public Board() { int nextID = 1; cells = new Cell[BOARD_HEIGHT, BOARD_WIDTH]; for (int i = 0; i < BOARD_HEIGHT; i++) { for (int j = 0; j < BOARD_WIDTH; j++) { cells[i, j] = new Cell() { row = i, col = j, ID = nextID++, piece = Piece.EMPTY }; } } setupMoveLocations(); }
public Cell() { topLeft = topRight = bottomLeft = bottomRight = null; }
private bool moveableCell(Cell start, Cell end) { List<Cell> movableLocations = new List<Cell>(); movableLocations.Add(start.bottomLeft); movableLocations.Add(start.bottomRight); movableLocations.Add(start.topRight); movableLocations.Add(start.topLeft); foreach (Cell cell in movableLocations) { try { if (cell.Equals(end)) { return true; } } catch (NullReferenceException) { Debug.WriteLine("Out of range"); } } return false; }