// returns 1 for live, 0 for has live neighbor, -1 for no live neighbor private int CheckStatus(GameCell neighbor) { if (neighbor.Live) { return(1); } else if (neighbor.Neighbors.LiveNeighbors == 0) { return(-1); } else { return(0); } }
public void ActivateCells() { int cellCount = BoardSize.Size * BoardSize.Size; int numberOfActiveCells = (int)(cellCount * Difficulty.Difficulty); Random rnd = new Random(); for (int i = 0; i < numberOfActiveCells; i++) { int x = rnd.Next(1, BoardSize.Size + 1); int y = rnd.Next(1, BoardSize.Size + 1); GameCell result = GameCells.Find(cell => cell.X == x && cell.Y == y && !cell.Live); while (result == null) { x = rnd.Next(1, BoardSize.Size + 1); y = rnd.Next(1, BoardSize.Size + 1); result = GameCells.Find(cell => cell.X == x && cell.Y == y && !cell.Live); } result.Live = true; } }
public CellHitImage(GameCell gameCell) : base(gameCell) { }
public CellWarningFlagImage(GameCell gameCell) : base(gameCell) { }
public CellBaseImage(GameCell gameCell) : base(gameCell) { }
public void SetWest(GameCell West) { neighbors.Add("West", West); UpdateLiveNeighbors(); }
public void SetSouth(GameCell South) { neighbors.Add("South", South); UpdateLiveNeighbors(); }
public void SetEast(GameCell East) { neighbors.Add("East", East); UpdateLiveNeighbors(); }
public void SetNorth(GameCell North) { neighbors.Add("North", North); UpdateLiveNeighbors(); }
public CellSafeImage(GameCell gameCell) : base(gameCell) { }
public CellFlagImage(GameCell gameCell) : base(gameCell) { }
public CellCautionFlagImage(GameCell gameCell) : base(gameCell) { }
public CellSuccessFlagImage(GameCell gameCell) : base(gameCell) { }