Beispiel #1
0
        public MinesweeperGame(GameDescription description, int seed, bool hardcore)
        {
            if (seed == 0)
            {
                this.seed = new Random().Next(1, Int32.MaxValue);
            }
            else
            {
                this.seed = seed;
            }

            this.description = description;
            this.hardcore    = hardcore;

            // create adjacent offsets
            adjacentOffset[0] = -description.width - 1;
            adjacentOffset[1] = -description.width;
            adjacentOffset[2] = -description.width + 1;
            adjacentOffset[3] = -1;
            adjacentOffset[4] = 1;
            adjacentOffset[5] = +description.width - 1;
            adjacentOffset[6] = +description.width;
            adjacentOffset[7] = +description.width + 1;

            tilesLeft = this.description.height * this.description.width - this.description.mines;
            minesLeft = description.mines;

            // create all the tiles. the mines get placed at the first clear.
            CreateTiles();
        }
Beispiel #2
0
 public MinesweeperGame(GameDescription description, int seed) : this(description, seed, true)
 {
 }