本文整理汇总了C#中Move.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Move.GetHashCode方法的具体用法?C# Move.GetHashCode怎么用?C# Move.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Move
的用法示例。
在下文中一共展示了Move.GetHashCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestInequality_DifferentRank
public static void TestInequality_DifferentRank()
{
Position position1 = new Position(File.G, Rank.Four);
Position position2 = new Position(File.H, Rank.Five);
Position position3 = new Position(File.F, Rank.Four);
Position position4 = new Position(File.H, Rank.Six);
Move move1 = new Move(position1, position2, Player.Black);
Move move2 = new Move(position3, position4, Player.Black);
Assert.AreNotEqual(move1, move2, "move1 and move2 are equal");
Assert.False(move1.Equals(move2), "move1.Equals(move2) should be false");
Assert.False(move2.Equals(move1), "move2.Equals(move1) should be false");
Assert.True(move1 != move2, "move1 != move2 should be true");
Assert.True(move2 != move1, "move2 != move1 should be true");
Assert.False(move1 == move2, "move1 == move2 should be true");
Assert.False(move2 == move1, "move2 == move1 should be true");
Assert.AreNotEqual(move1.GetHashCode(), move2.GetHashCode());
}
示例2: TestEquality
public static void TestEquality()
{
Position position1 = new Position(File.G, Rank.Four);
Position position2 = new Position(File.H, Rank.Five);
Position position3 = new Position(File.G, Rank.Four);
Position position4 = new Position(File.H, Rank.Five);
Move move1 = new Move(position1, position2, Player.White);
Move move2 = new Move(position3, position4, Player.White);
Move move3 = null;
Move move4 = null;
Assert.AreEqual(move1, move2, "move1 and move2 should be equal");
Assert.True(move1.Equals(move2), "move1.Equals(move2) should be true");
Assert.True(move2.Equals(move1), "move2.Equals(move1) should be true");
Assert.True(move1 == move2, "move1 == move2 should be true");
Assert.True(move2 == move1, "move2 == move1 should be true");
Assert.True(move3 == move4, "move3 == move4 should be True");
Assert.False(move1 != move2, "move1 != move2 should be false");
Assert.False(move2 != move1, "move2 != move1 should be false");
Assert.AreEqual(move1.GetHashCode(), move2.GetHashCode());
}
示例3: TestInequality_DifferentPromotion
public static void TestInequality_DifferentPromotion()
{
Position position1 = new Position(File.A, Rank.Seven);
Position position2 = new Position(File.A, Rank.Eight);
Move move1 = new Move(position1, position2, Player.White, Piece.Queen);
Move move2 = new Move(position1, position2, Player.White, Piece.Knight);
Assert.AreNotEqual(move1, move2, "move1 and move2 should not be equal");
Assert.False(move1.Equals(move2), "move1.Equals(move2) should be false");
Assert.False(move2.Equals(move1), "move2.Equals(move1) should be false");
Assert.True(move1 != move2, "move1 != move2 should be true");
Assert.True(move2 != move1, "move2 != move1 should be true");
Assert.False(move1 == move2, "move1 == move2 should be false");
Assert.False(move2 == move1, "move2 == move1 should be false");
Assert.AreNotEqual(move1.GetHashCode(), move2.GetHashCode());
}
示例4: TestInequality_DifferentRankAndFile
public static void TestInequality_DifferentRankAndFile()
{
Position position1 = new Position(File.G, 4);
Position position2 = new Position(File.H, 5);
Position position3 = new Position(File.A, 1);
Position position4 = new Position(File.B, 2);
Move move1 = new Move(position1, position2, Player.White);
Move move2 = new Move(position3, position4, Player.White);
Assert.AreNotEqual(move1, move2, "move1 and move2 are equal");
Assert.False(move1.Equals(move2), "move1.Equals(move2) should be false");
Assert.False(move2.Equals(move1), "move2.Equals(move1) should be false");
Assert.True(move1 != move2, "move1 != move2 should be true");
Assert.True(move2 != move1, "move2 != move1 should be true");
Assert.False(move1 == move2, "move1 == move2 should be true");
Assert.False(move2 == move1, "move2 == move1 should be true");
Assert.AreNotEqual(move1.GetHashCode(), move2.GetHashCode());
}