/// <summary> /// Gets the empty tile neighbors. /// </summary> /// <param name="grid">IGrid object.</param> /// <returns>A list of neighbors.</returns> private IList<Tile> GetNeighbours(IGrid grid) { List<Tile> neighbourTiles = new List<Tile>(); foreach (Tile tile in grid) { bool isValidNeighbour = grid.CanSwap(tile); if (isValidNeighbour) { neighbourTiles.Add(tile); } } return neighbourTiles; }