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


C# Move.GetHashCode方法代码示例

本文整理汇总了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());
 }
开发者ID:gunr2171,项目名称:Chess.NET,代码行数:17,代码来源:MoveTests.cs

示例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());
 }
开发者ID:gunr2171,项目名称:Chess.NET,代码行数:20,代码来源:MoveTests.cs

示例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());
 }
开发者ID:gunr2171,项目名称:Chess.NET,代码行数:15,代码来源:MoveTests.cs

示例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());
 }
开发者ID:ProgramFOX,项目名称:Chess.NET,代码行数:17,代码来源:MoveTests.cs


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