当前位置: 首页>>代码示例>>C#>>正文


C# Game.CreateCheckers方法代码示例

本文整理汇总了C#中Game.CreateCheckers方法的典型用法代码示例。如果您正苦于以下问题:C# Game.CreateCheckers方法的具体用法?C# Game.CreateCheckers怎么用?C# Game.CreateCheckers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game的用法示例。


在下文中一共展示了Game.CreateCheckers方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: _003_CheckerProperties

        public void _003_CheckerProperties()
        {
            var game = new Game();
            game.CreateCheckers(false);

            var actualChecker = game.CheckersSet[0];
            var expectedChecker = new Checker(false, false, new Coordinate(0, 1));

            Assert.AreEqual(expectedChecker, actualChecker);
        }
开发者ID:Zhenya21,项目名称:Checkers,代码行数:10,代码来源:CheckerTests.cs

示例2: _006_WhiteCheckerChangesItsSymbolUponBecomingQueen

        public void _006_WhiteCheckerChangesItsSymbolUponBecomingQueen()
        {
            var game = new Game();
            game.CreateCheckers(false);

            game.CheckersSet[5].Coordinate.Change(new Coordinate(7, 0));

            game.CheckerBecomesQueen(game.CheckersSet[5]);

            Assert.IsTrue(game.CheckersSet[5].DrawChecker() == '☼');
        }
开发者ID:kolinlob,项目名称:Checkers,代码行数:11,代码来源:CheckerTests.cs

示例3: _004_BlackCheckerCanBecomeQueen

        public void _004_BlackCheckerCanBecomeQueen()
        {
            var game = new Game();
            game.CreateCheckers(false);

            game.CheckersSet[5].Coordinate.Change(new Coordinate(7,0));
            game.CheckerBecomesQueen(game.CheckersSet[5]);

            var expected = game.CheckersSet[5].IsQueen;

            Assert.IsTrue(expected);
        }
开发者ID:kolinlob,项目名称:Checkers,代码行数:12,代码来源:CheckerTests.cs

示例4: _005_WhiteCheckerCanBecomeQueen

        public void _005_WhiteCheckerCanBecomeQueen()
        {
            var game = new Game();
            game.CreateCheckers(true);

            game.CheckersSet[7].Coordinate.Change(new Coordinate(0,1));

            game.CheckerBecomesQueen(game.CheckersSet[7]);

            var expected = game.CheckersSet[7].IsQueen;

            Assert.IsTrue(expected);
        }
开发者ID:kolinlob,项目名称:Checkers,代码行数:13,代码来源:CheckerTests.cs

示例5: _001_Player_Can_Select_Checker

        public void _001_Player_Can_Select_Checker()
        {
            var game = new Game();
            var validInput = new FakePlayer(true).EnterCoordinates();

            var expectedChecker = new Checker(false, false, new Coordinate(2, 1));

            game.CreateCheckers(false);

            var moveStartCoordinate = game.ConvertIntoCoordinates(validInput);
            var actualChecker = game.GetChecker(moveStartCoordinate);

            Assert.AreEqual(actualChecker, expectedChecker);
        }
开发者ID:kolinlob,项目名称:Checkers,代码行数:14,代码来源:PlayerTests.cs

示例6: _003_White_Checkers_Are_In_Start_Position

        public void _003_White_Checkers_Are_In_Start_Position()
        {
            var game = new Game();
            game.CreateCheckers(true);

            var expected = new List<Checker>
            {
                new Checker(true, false, new Coordinate(5, 0)),
                new Checker(true, false, new Coordinate(5, 2)),
                new Checker(true, false, new Coordinate(5, 4)),
                new Checker(true, false, new Coordinate(5, 6)),
                new Checker(true, false, new Coordinate(6, 1)),
                new Checker(true, false, new Coordinate(6, 3)),
                new Checker(true, false, new Coordinate(6, 5)),
                new Checker(true, false, new Coordinate(6, 7)),
                new Checker(true, false, new Coordinate(7, 0)),
                new Checker(true, false, new Coordinate(7, 2)),
                new Checker(true, false, new Coordinate(7, 4)),
                new Checker(true, false, new Coordinate(7, 6))
            };

            CollectionAssert.AreEqual(expected, game.CheckersSet);
        }
开发者ID:kolinlob,项目名称:Checkers,代码行数:23,代码来源:GameTests.cs

示例7: _002_Black_Checkers_Are_In_Start_Position

        public void _002_Black_Checkers_Are_In_Start_Position()
        {
            var game = new Game();
            game.CreateCheckers(false);

            var expected = new List<Checker>
            {
                new Checker(false, false, new Coordinate(0, 1)),
                new Checker(false, false, new Coordinate(0, 3)),
                new Checker(false, false, new Coordinate(0, 5)),
                new Checker(false, false, new Coordinate(0, 7)),
                new Checker(false, false, new Coordinate(1, 0)),
                new Checker(false, false, new Coordinate(1, 2)),
                new Checker(false, false, new Coordinate(1, 4)),
                new Checker(false, false, new Coordinate(1, 6)),
                new Checker(false, false, new Coordinate(2, 1)),
                new Checker(false, false, new Coordinate(2, 3)),
                new Checker(false, false, new Coordinate(2, 5)),
                new Checker(false, false, new Coordinate(2, 7))
            };

            CollectionAssert.AreEqual(expected, game.CheckersSet);
        }
开发者ID:kolinlob,项目名称:Checkers,代码行数:23,代码来源:GameTests.cs

示例8: _007_BlackCheckerChangesItsSymbolUponBecomingQueen

        public void _007_BlackCheckerChangesItsSymbolUponBecomingQueen()
        {
            var game = new Game();
            game.CreateCheckers(true);

            game.CheckersSet[7].Coordinate.X = 0;
            game.CheckersSet[7].Coordinate.Y = 1;

            game.CheckerBecomesQueen(game.CheckersSet[7]);

            Assert.IsTrue(game.CheckersSet[7].DrawChecker() == '☼');
        }
开发者ID:Zhenya21,项目名称:Checkers,代码行数:12,代码来源:CheckerTests.cs

示例9: _021_Cannot_Select_Blocked_Checker

        public void _021_Cannot_Select_Blocked_Checker()
        {
            var game = new Game
            {
                Board = new Board(),
                Player1 = new FakePlayer(true),
                Player2 = new FakePlayer(false),
                CheckersSet = new List<Checker>()
            };

            game.CurrentPlayer = game.Player1;

            game.CreateCheckers(false);
            game.CreateCheckers(true);

            var checker = game.CheckersSet.Last();

            game.FindCheckersWithTakes();

            var expected = game.CanSelectChecker(checker);
            Assert.IsFalse(expected);
        }
开发者ID:kolinlob,项目名称:Checkers,代码行数:22,代码来源:GameTests.cs

示例10: _017_Cannot_Move_to_Unusable_Cell

        public void _017_Cannot_Move_to_Unusable_Cell()
        {
            var game = new Game
            {
                Board = new Board(),
                Player1 = new FakePlayer(true),
                Player2 = new FakePlayer(false)
            };
            game.CurrentPlayer = game.Player1;

            game.CreateCheckers(false);
            game.CreateCheckers(true);

            game.CurrentPlayer = new FakePlayer(true);

            var moveStartCoordinate = game.ConvertIntoCoordinates(game.CurrentPlayer.EnterCoordinates());
            var checker = game.GetChecker(moveStartCoordinate);
            checker.IsQueen = true;

            var moveEndCoordinate = game.ConvertIntoCoordinates("C4");

            var canMoveThere = game.CanMoveThere(moveStartCoordinate, moveEndCoordinate);
            Assert.IsFalse(canMoveThere);
        }
开发者ID:kolinlob,项目名称:Checkers,代码行数:24,代码来源:GameTests.cs

示例11: _016_Cannot_Get_Any_Checker_If_Empty_Cell_Selected

        public void _016_Cannot_Get_Any_Checker_If_Empty_Cell_Selected()
        {
            var game = new Game
            {
                Board = new Board(),
                Player1 = new FakePlayer(true),
                Player2 = new FakePlayer(false)
            };
            game.CurrentPlayer = game.Player1;

            game.CreateCheckers(false);
            game.CreateCheckers(true);

            const string validAdress = "A8";
            var adress = game.ConvertIntoCoordinates(validAdress);
            var coordinate = new Coordinate(adress.X, adress.Y);

            var checker = game.GetChecker(coordinate);
            var canSelect = game.CanSelectChecker(checker);

            Assert.IsFalse(canSelect);
        }
开发者ID:kolinlob,项目名称:Checkers,代码行数:22,代码来源:GameTests.cs

示例12: _015_Can_Get_Checker

        public void _015_Can_Get_Checker()
        {
            var game = new Game
            {
                Board = new Board(),
                Player1 = new FakePlayer(true),
                Player2 = new FakePlayer(false)
            };
            game.CurrentPlayer = game.Player2;

            game.CreateCheckers(false);
            game.CreateCheckers(true);

            game.FindCheckersWithTakes();

            var validAdress = game.CurrentPlayer.EnterCoordinates();
            var moveStartCoordinate = game.ConvertIntoCoordinates(validAdress);

            var checker = game.GetChecker(moveStartCoordinate);
            var canSelectChecker = game.CanSelectChecker(checker);

            Assert.IsTrue(canSelectChecker);
        }
开发者ID:kolinlob,项目名称:Checkers,代码行数:23,代码来源:GameTests.cs


注:本文中的Game.CreateCheckers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。