コード例 #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);
     }
 }
コード例 #2
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;
            }
        }
コード例 #3
0
 public CellHitImage(GameCell gameCell) : base(gameCell)
 {
 }
コード例 #4
0
 public CellWarningFlagImage(GameCell gameCell) : base(gameCell)
 {
 }
コード例 #5
0
 public CellBaseImage(GameCell gameCell) : base(gameCell)
 {
 }
コード例 #6
0
 public void SetWest(GameCell West)
 {
     neighbors.Add("West", West);
     UpdateLiveNeighbors();
 }
コード例 #7
0
 public void SetSouth(GameCell South)
 {
     neighbors.Add("South", South);
     UpdateLiveNeighbors();
 }
コード例 #8
0
 public void SetEast(GameCell East)
 {
     neighbors.Add("East", East);
     UpdateLiveNeighbors();
 }
コード例 #9
0
 public void SetNorth(GameCell North)
 {
     neighbors.Add("North", North);
     UpdateLiveNeighbors();
 }
コード例 #10
0
 public CellSafeImage(GameCell gameCell) : base(gameCell)
 {
 }
コード例 #11
0
 public CellFlagImage(GameCell gameCell) : base(gameCell)
 {
 }
コード例 #12
0
 public CellCautionFlagImage(GameCell gameCell) : base(gameCell)
 {
 }
コード例 #13
0
 public CellSuccessFlagImage(GameCell gameCell) : base(gameCell)
 {
 }