Esempio n. 1
0
        //creates a new blcok, and a grid out of blocks
        public void NewGame()
        {
            Minesweeper.Block blocky = new Minesweeper.Block(0, false, true);

            //make a grid with bombs and the numbers
            gridy = new Gridy(blocky, MyVariables.row, MyVariables.column);
            gridy.MineIt(MyVariables.mine);
            gridy.NumberIt();
            gridy.RemainingBombsCount();

            stopWatch.Start();
            dt.Start();
        }
Esempio n. 2
0
        //creates a grid, adds 2 mines and verifies the adjacent cells have the values
        // that represent the adjacent mines count
        public void AssertAdjacentMineNumberIt()
        {
            int  mine   = 0;
            bool flag   = false;
            bool hide   = true;
            int  row    = 3;
            int  column = 3;

            Block block1 = new Block(mine, flag, hide);
            Gridy grid1  = new Gridy(block1, row, column);

            grid1.theGrid[0, 0].Mine = 9;
            grid1.theGrid[1, 1].Mine = 9;

            grid1.NumberIt();

            Assert.AreEqual(grid1.theGrid[0, 1].Mine, 2);
            Assert.AreEqual(grid1.theGrid[1, 2].Mine, 1);
            Assert.AreEqual(grid1.theGrid[0, 3].Mine, 0);
        }