Exemple #1
0
 public Tile CellContent(Cell cell) {
     if (WithinBounds(cell)) {
         return Tiles[cell.X][cell.Y];
     }
     return null;
 }
Exemple #2
0
 public bool WithinBounds(Cell cell) {
     return cell.X >= 0 && cell.X < size &&
            cell.Y >= 0 && cell.Y < size;
 }
Exemple #3
0
 public bool CellAvailable(Cell cell) {
     return !CellOccupied(cell);
 }
Exemple #4
0
 bool CellOccupied(Cell cell) {
     return CellContent(cell) != null;
 }
Exemple #5
0
 public void MoveTile(Tile tile, Cell cell) {
     if (!tile.PositionsEqual(cell)) {
         cells[tile.X][tile.Y] = null;
         cells[cell.X][cell.Y] = tile;
         tile.UpdatePosition(cell);
     }
 }
Exemple #6
0
 public bool PositionsEqual(Cell cell) {
     return cell.X == this.X &&
            cell.Y == this.Y;
 }
Exemple #7
0
 public void SavePosition() {
     previousPosition = new Cell { X = X, Y = Y };
 }
Exemple #8
0
 public void UpdatePosition(Cell cell) {
     X = cell.X;
     Y = cell.Y;
     OnPositionUpdated(EventArgs.Empty);
 }
Exemple #9
0
 public Tile(Cell cell, int value = 2) {
     X = cell.X;
     Y = cell.Y;
     this.value = value;
 }