Exemple #1
0
 // 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)
 {
 }
Exemple #4
0
 public CellWarningFlagImage(GameCell gameCell) : base(gameCell)
 {
 }
Exemple #5
0
 public CellBaseImage(GameCell gameCell) : base(gameCell)
 {
 }
Exemple #6
0
 public void SetWest(GameCell West)
 {
     neighbors.Add("West", West);
     UpdateLiveNeighbors();
 }
Exemple #7
0
 public void SetSouth(GameCell South)
 {
     neighbors.Add("South", South);
     UpdateLiveNeighbors();
 }
Exemple #8
0
 public void SetEast(GameCell East)
 {
     neighbors.Add("East", East);
     UpdateLiveNeighbors();
 }
Exemple #9
0
 public void SetNorth(GameCell North)
 {
     neighbors.Add("North", North);
     UpdateLiveNeighbors();
 }
Exemple #10
0
 public CellSafeImage(GameCell gameCell) : base(gameCell)
 {
 }
 public CellFlagImage(GameCell gameCell) : base(gameCell)
 {
 }
 public CellCautionFlagImage(GameCell gameCell) : base(gameCell)
 {
 }
 public CellSuccessFlagImage(GameCell gameCell) : base(gameCell)
 {
 }