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


C# Move.Equals方法代码示例

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


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

示例1: EqualsReturnsFalseWhenBoardIsDifferent

        public void EqualsReturnsFalseWhenBoardIsDifferent()
        {
            int[,] data1 = {
                {9,0,0, 0,0,5, 6,8,1 },
                {0,6,0, 2,8,0, 7,0,0 },
                {0,0,0, 0,0,6, 9,0,5 },
                {0,8,0, 0,0,2, 0,4,6 },
                {0,0,5, 0,0,0, 3,0,0 },
                {1,9,0, 5,0,0, 0,7,0 },
                {8,0,2, 9,0,0, 0,0,0 },
                {0,0,9, 0,2,7, 0,6,0 },
                {6,7,4, 8,0,0, 0,0,3 }
            };

            int[,] data2 = {
                {9,0,0, 0,0,5, 6,8,1 },
                {0,6,0, 2,8,0, 7,0,0 },
                {0,0,0, 0,0,6, 9,0,5 },
                {0,8,0, 0,0,2, 0,4,6 },
                {0,0,5, 0,0,0, 3,0,0 },
                {1,9,0, 5,0,0, 0,7,0 },
                {8,0,2, 9,0,0, 0,0,0 },
                {0,0,9, 0,2,7, 0,6,0 },
                {6,7,4, 8,0,0, 0,1,3 }
            };

            IBoard board1 = new Board(data1);
            IBoard board2 = new Board(data2);

            IMove move1 = new Move(board1, 0, 1, 2);
            IMove move2 = new Move(board2, 0, 1, 2);

            Assert.False(move1.Equals(move2));
            Assert.False(move2.Equals(move1));
        }
开发者ID:sayedihashimi,项目名称:sudoku,代码行数:35,代码来源:MoveTests.cs

示例2: TestEquality

 public void TestEquality( int a1, int b1, MoveFlags f1, int a2, int b2, MoveFlags f2, bool areEqual )
 {
     var left = new Move(a1, b1, f1);
     var right = new Move(a2, b2, f2);
     Assert.AreEqual(areEqual, left == right);
     Assert.AreNotEqual(areEqual, left != right);
     Assert.AreEqual(areEqual, left.Equals(right));
     Assert.AreEqual(areEqual, right == left);
     Assert.AreNotEqual(areEqual, right != left);
     Assert.AreEqual(areEqual, right.Equals(left));
 }
开发者ID:sabarishk1905,项目名称:ChessSharp,代码行数:11,代码来源:TestMove.cs

示例3: animateMove

    public void animateMove(Move myMove)
    {
        if (myMove.Equals (Move.Sidestep)) {
            msAnimator.SetTrigger ("triggerRoll");
            audioSidestep.Play();

        } else if (myMove.Equals (Move.Shoot)) {
            msAnimator.SetTrigger ("triggerLasers");
            audioShoot.Play();
        }

        //chargerLeft.SetActive (loaded);
        //chargerRight.SetActive (loaded);
        msAnimator.SetBool ("isCharged", loaded);

        if (loaded) {
            audioLoad.Play ();
        } else {
            audioLoad.Pause ();
        }
    }
开发者ID:jeevnayak,项目名称:RPS,代码行数:21,代码来源:PlayerController.cs

示例4: 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

示例5: 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

示例6: TestInequality_DifferentType

 public static void TestInequality_DifferentType()
 {
     Position position1 = new Position(File.G, Rank.Four);
     Position position2 = new Position(File.G, Rank.Eight);
     Move move1 = new Move(position1, position2, Player.Black);
     Assert.False(move1.Equals(position1), "move1.Equals(position1) should be false");
 }
开发者ID:gunr2171,项目名称:Chess.NET,代码行数:7,代码来源:MoveTests.cs

示例7: 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

示例8: 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

示例9: compareMoves

        /******************************
         *
        /*  Compare moves
        /*
         * ******************************/
        private int compareMoves(Move a, Move b)
        {
            // Tie
            if (a.Equals(b))
                return 0;

            switch (a)
            {
                case Move.ROCK:
                    return (b == Move.SCISSORS ? 1 : -1);
                case Move.PAPER:
                    return (b == Move.ROCK ? 1 : -1);
                case Move.SCISSORS:
                    return (b == Move.PAPER ? 1 : -1);
            }

            // Should never reach here
            return 0;
        }
开发者ID:arismarko,项目名称:factorypatterngame,代码行数:24,代码来源:rpcGame.cs


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