本文整理汇总了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);
}
示例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);
}
示例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);
}