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


C# Board.AllowCastlingAll方法代码示例

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


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

示例1: TestCastlingNoKingsideWhite

        public void TestCastlingNoKingsideWhite()
        {
            var b = new Board(false);
            b.State[0] = Colors.Val(Piece.Rook, Color.White);
            b.State[7] = Colors.Val(Piece.Rook, Color.White);
            b.State[4] = Colors.Val(Piece.King, Color.White);

            b.State[56] = Colors.Val(Piece.Rook, Color.Black);
            b.State[63] = Colors.Val(Piece.Rook, Color.Black);
            b.State[60] = Colors.Val(Piece.King, Color.Black);

            b.AllowCastlingAll();

            b.PlayerTurn = Color.White;
            b.Move(7, 6);

            Assert.IsTrue(b.CanCastleKBlack);
            Assert.IsFalse(b.CanCastleKWhite);
            Assert.IsTrue(b.CanCastleQBlack);
            Assert.IsTrue(b.CanCastleQWhite);

            // test that we can't just move back
            b.PlayerTurn = Color.White;
            b.Move(6, 7);

            Assert.IsTrue(b.CanCastleKBlack);
            Assert.IsFalse(b.CanCastleKWhite);
            Assert.IsTrue(b.CanCastleQBlack);
            Assert.IsTrue(b.CanCastleQWhite);
        }
开发者ID:adh2050,项目名称:Chess,代码行数:30,代码来源:TestBoard.cs

示例2: TestCastlingNoPieces

 public void TestCastlingNoPieces()
 {
     var b = new Board(false);
     b.AllowCastlingAll(); // Can't do this without any pieces on the board
     Assert.IsFalse(b.CanCastleKBlack);
     Assert.IsFalse(b.CanCastleKWhite);
     Assert.IsFalse(b.CanCastleQBlack);
     Assert.IsFalse(b.CanCastleQWhite);
 }
开发者ID:adh2050,项目名称:Chess,代码行数:9,代码来源:TestBoard.cs

示例3: TestCastlingOK

        public void TestCastlingOK()
        {
            var b = new Board(false);
            b.State[0] = Colors.Val(Piece.Rook, Color.White);
            b.State[7] = Colors.Val(Piece.Rook, Color.White);
            b.State[4] = Colors.Val(Piece.King, Color.White);

            b.State[56] = Colors.Val(Piece.Rook, Color.Black);
            b.State[63] = Colors.Val(Piece.Rook, Color.Black);
            b.State[60] = Colors.Val(Piece.King, Color.Black);

            b.AllowCastlingAll();
            Assert.IsTrue(b.CanCastleKBlack);
            Assert.IsTrue(b.CanCastleKWhite);
            Assert.IsTrue(b.CanCastleQBlack);
            Assert.IsTrue(b.CanCastleQWhite);
        }
开发者ID:adh2050,项目名称:Chess,代码行数:17,代码来源:TestBoard.cs


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