當前位置: 首頁>>代碼示例>>C#>>正文


C# Board.Touch方法代碼示例

本文整理匯總了C#中Board.Touch方法的典型用法代碼示例。如果您正苦於以下問題:C# Board.Touch方法的具體用法?C# Board.Touch怎麽用?C# Board.Touch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Board的用法示例。


在下文中一共展示了Board.Touch方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: WhenTouchZero_TheresOneBombs3

        public void WhenTouchZero_TheresOneBombs3()
        {
            var board = new Board(5, 5);
            board.SetBomb(4, 4);
            board.SetBomb(2, 3);

            board.Touch(0, 0);

            var notOpendCellIndexes = new []{ Tuple.Create(2, 3), Tuple.Create(2, 4), Tuple.Create(3, 4), Tuple.Create(4, 4) };

            for (int x = 0; x < 5; ++x)
                for (int y = 0; y < 5; ++y)
                {
                    if (notOpendCellIndexes.Any(idx => idx.Item1 == x && idx.Item2 == y))
                    {
                        Assert.That(board.GetCell(x, y).IsOpened, Is.False);
                    }
                    else
                    {
                        Assert.That(board.GetCell(x, y).IsOpened, Is.True);
                    }
                }
        }
開發者ID:Khanchai,項目名稱:Minesweeper,代碼行數:23,代碼來源:BoadTest.cs

示例2: WhenTouchZero_TheresOneBombs

        public void WhenTouchZero_TheresOneBombs()
        {
            var board = new Board(3, 3);
            board.SetBomb(2, 2);
            board.Touch(0, 0);

            for (int x = 0; x < 3; ++x)
                for (int y = 0; y < 3; ++y)
                {
                    if (x == 2 && y == 2)
                    {
                        Assert.That(board.GetCell(x, y).IsOpened, Is.False);
                    }
                    else
                    {
                        Assert.That(board.GetCell(x, y).IsOpened, Is.True);
                    }
                }
        }
開發者ID:Khanchai,項目名稱:Minesweeper,代碼行數:19,代碼來源:BoadTest.cs

示例3: WhenTouchZero_TheresOneBombs2

        public void WhenTouchZero_TheresOneBombs2()
        {
            var board = new Board(5, 5);
            board.SetBomb(4, 4);
            board.Touch(0, 0);

            for (int x = 0; x < 5; ++x)
                for (int y = 0; y < 5; ++y)
                {
                    if (x == 4 && y == 4)
                    {
                        Assert.That(board.GetCell(x, y).IsOpened, Is.False);
                    }
                    else
                    {
                        Assert.That(board.GetCell(x, y).IsOpened, Is.True);
                    }
                }
        }
開發者ID:Khanchai,項目名稱:Minesweeper,代碼行數:19,代碼來源:BoadTest.cs

示例4: WhenTouchZero_TheresNoBombs

        public void WhenTouchZero_TheresNoBombs()
        {
            var board = new Board(3, 3);

            board.Touch(0, 0);
            for (int x = 0; x < 3; x++)
                for (int y = 0; y < 3; y++)
                {
                    Assert.That(board.GetCell(x, y).IsOpened, Is.True);
                }
        }
開發者ID:Khanchai,項目名稱:Minesweeper,代碼行數:11,代碼來源:BoadTest.cs

示例5: WhenTouchBomb_GameOver3

        public void WhenTouchBomb_GameOver3()
        {
            var board = new Board(10, 10);
            board.SetBomb(1, 1);

            board.Touch(1, 2);
            Assert.That(board.State, Is.Not.EqualTo(GameState.GameOver));
        }
開發者ID:Khanchai,項目名稱:Minesweeper,代碼行數:8,代碼來源:BoadTest.cs

示例6: TouchSafetyCell

        public void TouchSafetyCell()
        {
            var board = new Board(3, 3);
            board.SetBomb(2, 2);
            board.Touch(1, 0);

            for (int x = 0; x < 3; ++x)
                for (int y = 0; y < 3; ++y)
                {
                    if (x == 2 && y == 2)
                    {
                        Assert.That(board.GetCell(x, y).IsOpened, Is.False);
                    }
                    else
                    {
                        Assert.That(board.GetCell(x, y).IsOpened, Is.True);
                    }
                }
        }
開發者ID:Khanchai,項目名稱:Minesweeper,代碼行數:19,代碼來源:BoadTest.cs

示例7: TestTouchTwoCellOfBoard

        public void TestTouchTwoCellOfBoard()
        {
            var board = new Board(10, 10);
            board.Touch(1, 1);

            Assert.That(board.GetCell(1, 1).IsOpened, Is.True);
        }
開發者ID:Khanchai,項目名稱:Minesweeper,代碼行數:7,代碼來源:BoadTest.cs

示例8: TestTouchCellOfBoard0

        public void TestTouchCellOfBoard0()
        {
            var board = new Board(3, 3);
            board.Touch(0, 0);

            Assert.That(board.GetCell(0, 0).IsOpened, Is.True);
        }
開發者ID:Khanchai,項目名稱:Minesweeper,代碼行數:7,代碼來源:BoadTest.cs


注:本文中的Board.Touch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。