List<Cell> adjacentCells(int y, int x) {
    var adjacent = new ArrayList<Cell>();
    if (y == 0) {
      adjacent.add(this.cells[1][x]);
    }
    if (x == 0) {
      adjacent.add(this.cells[y][1]);
    }
    if (y == cells.length - 1) {
      adjacent.add(this.cells[cells.length - 2][x]);
    }
    if (x == cells.length - 1) {
      adjacent.add(this.cells[y][cells.length - 2]);
    }
    if (y > 0 && y < cells.length - 1) {
      adjacent.add(this.cells[y - 1][x]);
      adjacent.add(this.cells[y + 1][x]);
    }
    if (x > 0 && x < cells.length - 1) {
      adjacent.add(this.cells[y][x - 1]);
      adjacent.add(this.cells[y][x + 1]);
    }
    return adjacent;
  }
@Test
  void adjacentCellsTest() {
    var cg = new CandyGame(3, new CellPool(9));
    var arr1 = cg.adjacentCells(0, 0);
    var arr2 = cg.adjacentCells(1, 2);
    var arr3 = cg.adjacentCells(1, 1);
    assertTrue(arr1.size() == 2 && arr2.size() == 3 && arr3.size() == 4);
  }