Пример #1
0
        public void Build(Tuple <int, int> size)
        {
            this.grid = new GridSquare[size.Item1, size.Item2];

            for (int i = 0; i < size.Item1; i++)
            {
                for (int j = 0; j < size.Item2; j++)
                {
                    GridSquare newSquare = this.grid[i, j] = new GridSquare();
                    newSquare.Neighbors = this.LinkToNeighbors(i, j);
                }
            }
        }
Пример #2
0
        private bool MakeDangerous(Random r, out GridSquare dSquare)
        {
            int dangery = r.Next(this.grid.GetLength(0));
            int dangerx = r.Next(this.grid.GetLength(1));

            dSquare = this.grid[dangery, dangerx];
            if (dSquare.SquareType == SquareType.DangerousHidden)
            {
                return(true);
            }

            dSquare.SquareType = SquareType.DangerousHidden;
            return(false);
        }
Пример #3
0
        public bool Reveal(string coordinate)
        {
            int[]      coords     = coordinate.Split(' ').Cast <int>().ToArray();
            GridSquare gridSquare = this.grid[coords[0], coords[1]];

            if (gridSquare.SquareType == SquareType.DangerousHidden)
            {
                gridSquare.SquareType = SquareType.DangerousShow;
                return(false);
            }

            gridSquare.SquareType = SquareType.SafeShown;
            return(true);
        }
Пример #4
0
 private void WarnSiblings(GridSquare[,] gridSquares, GridSquare dSquare)
 {
     throw new NotImplementedException();
 }