public List <System.Windows.Point> onClick(int x, int y) { List <System.Windows.Point> list = new List <System.Windows.Point>(); Queue <Tile> queue = new Queue <Tile>(); Tile t = boardTiles[x, y]; if (!t.isFlagged()) { if (t.getValue() == MINE) { gameOver = true; } else { queue.Enqueue(t); list.Add(new System.Windows.Point(t.getX(), t.getY())); } } while (queue.Count != 0) { Tile current = queue.Dequeue(); current.setHidden(false); tilesRevealed++; if (totalMines == (boardHeight * boardWidth) - tilesRevealed) { win = true; break; } if (current.getValue() == 0) { List <Tile> tiles = current.getAdjacentTiles(); foreach (Tile tile in tiles) { if (tile.isHidden() && !queue.Contains(tile)) { queue.Enqueue(tile); list.Add(new System.Windows.Point(tile.getX(), tile.getY())); } } } } return(list); }