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


C# Field.UnmakeMove方法代码示例

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


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

示例1: CalculateHash_VeryLongGame

        public void CalculateHash_VeryLongGame()
        {
            var field = new Field(39, 32);
            ZobristHashField hash = new ZobristHashField(field, 0);

            ulong initKey = hash.Key;

            GameMove[] moves = TestUtils.LoadMovesFromPointsXt("VeryLongGame.sav");

            foreach (var move in moves)
            {
                Assert.AreEqual(true, field.MakeMove(move.Column, move.Row));
                hash.UpdateHash();
            }

            while (field.States.Count() != 0)
            {
                field.UnmakeMove();
                hash.UpdateHash();
            }

            Assert.AreEqual(initKey, hash.Key);
        }
开发者ID:KvanTTT,项目名称:Dots-Game-AI,代码行数:23,代码来源:ZobristHashTest.cs

示例2: CalculateHash_SimpleSequence

        public void CalculateHash_SimpleSequence()
        {
            int startX = 16;
            int startY = 16;

            var field = new Field(39, 32);
            ZobristHashField hash = new ZobristHashField(field, 0);

            ulong initKey = hash.Key;

            field.MakeMove(startX, startY);
            hash.UpdateHash();

            field.MakeMove(startX + 1, startY);
            hash.UpdateHash();

            field.MakeMove(startX + 1, startY + 1);
            hash.UpdateHash();

            field.MakeMove(startX, startY + 1);
            hash.UpdateHash();

            while (field.States.Count() != 0)
            {
                field.UnmakeMove();
                hash.UpdateHash();
            }

            Assert.AreEqual(hash.Key, initKey);
        }
开发者ID:KvanTTT,项目名称:Dots-Game-AI,代码行数:30,代码来源:ZobristHashTest.cs

示例3: CalculateHash_EmptyBase

        public void CalculateHash_EmptyBase()
        {
            int startX = 16;
            int startY = 16;

            var field = new Field(39, 32);
            ZobristHashField hash = new ZobristHashField(field, 0);

            ulong initKey = hash.Key;

            field.MakeMove(startX, startY);
            hash.UpdateHash();
            field.MakeMove(startX + 10, startY);
            hash.UpdateHash();

            field.MakeMove(startX + 1, startY + 1);
            hash.UpdateHash();
            field.MakeMove(startX + 10, startY + 1);
            hash.UpdateHash();

            field.MakeMove(startX + 2, startY + 1);
            hash.UpdateHash();
            field.MakeMove(startX + 10, startY + 2);
            hash.UpdateHash();

            field.MakeMove(startX + 3, startY);
            hash.UpdateHash();
            field.MakeMove(startX + 10, startY + 3);
            hash.UpdateHash();

            field.MakeMove(startX + 2, startY - 1);
            hash.UpdateHash();
            field.MakeMove(startX + 10, startY + 4);
            hash.UpdateHash();

            field.MakeMove(startX + 1, startY - 1);
            hash.UpdateHash();
            field.MakeMove(startX + 1, startY);
            hash.UpdateHash();

            while (field.States.Count() != 0)
            {
                field.UnmakeMove();
                hash.UpdateHash();
            }

            Assert.AreEqual(initKey, hash.Key);
        }
开发者ID:KvanTTT,项目名称:Dots-Game-AI,代码行数:48,代码来源:ZobristHashTest.cs

示例4: CalculateHash_EnemyBaseInBase

        public void CalculateHash_EnemyBaseInBase()
        {
            int startX = 5;
            int startY = 2;

            var field = new Field(39, 32);
            ZobristHashField hash = new ZobristHashField(field, 0);

            ulong initKey = hash.Key;

            // center.
            field.MakeMove(startX + 1, startY + 3);
            hash.UpdateHash();
            field.MakeMove(startX, startY + 3);
            hash.UpdateHash();

            field.MakeMove(startX + 10, startY + 2);
            hash.UpdateHash();
            field.MakeMove(startX + 1, startY + 2);
            hash.UpdateHash();

            field.MakeMove(startX + 10, startY + 3);
            hash.UpdateHash();
            field.MakeMove(startX + 2, startY + 2);
            hash.UpdateHash();

            field.MakeMove(startX + 10, startY + 4);
            hash.UpdateHash();
            field.MakeMove(startX + 3, startY + 3);
            hash.UpdateHash();

            field.MakeMove(startX + 10, startY + 5);
            hash.UpdateHash();
            field.MakeMove(startX + 2, startY + 4);
            hash.UpdateHash();

            field.MakeMove(startX + 10, startY + 6);
            hash.UpdateHash();
            field.MakeMove(startX + 1, startY + 4);
            hash.UpdateHash();

            PutBigBase(field, hash);

            ulong firstHash = hash.Key;

            while (field.States.Count() != 0)
            {
                field.UnmakeMove();
                hash.UpdateHash();
            }

            Assert.AreEqual(initKey, hash.Key);

            startX = 16;
            startY = 16;
        }
开发者ID:KvanTTT,项目名称:Dots-Game-AI,代码行数:56,代码来源:ZobristHashTest.cs

示例5: CalculateHash_DifferentBaseCreationOrder

        public void CalculateHash_DifferentBaseCreationOrder()
        {
            int startX = 16;
            int startY = 16;

            var field = new Field(39, 32);
            ZobristHashField hash = new ZobristHashField(field, 0);

            ulong initKey = hash.Key;

            field.MakeMove(startX, startY);
            hash.UpdateHash();
            field.MakeMove(startX + 1, startY);
            hash.UpdateHash();

            field.MakeMove(startX + 1, startY + 1);
            hash.UpdateHash();
            field.MakeMove(startX + 2, startY + 1);
            hash.UpdateHash();

            field.MakeMove(startX + 1, startY - 1);
            hash.UpdateHash();
            field.MakeMove(startX + 2, startY - 1);
            hash.UpdateHash();

            field.MakeMove(startX + 2, startY);
            hash.UpdateHash();
            field.MakeMove(startX + 3, startY);
            hash.UpdateHash();

            field.MakeMove(startX - 2, startY);
            hash.UpdateHash();
            field.MakeMove(startX - 2, startY - 1);
            hash.UpdateHash();

            ulong firstHash = hash.Key;

            while (field.States.Count() != 0)
            {
                field.UnmakeMove();
                hash.UpdateHash();
            }

            Assert.AreEqual(hash.Key, initKey);

            field.MakeMove(startX - 2, startY);
            hash.UpdateHash();
            field.MakeMove(startX + 1, startY);
            hash.UpdateHash();

            field.MakeMove(startX, startY);
            hash.UpdateHash();
            field.MakeMove(startX + 2, startY + 1);
            hash.UpdateHash();

            field.MakeMove(startX + 1, startY + 1);
            hash.UpdateHash();
            field.MakeMove(startX + 2, startY - 1);
            hash.UpdateHash();

            field.MakeMove(startX + 1, startY - 1);
            hash.UpdateHash();
            field.MakeMove(startX + 3, startY);
            hash.UpdateHash();

            field.MakeMove(startX + 2, startY);
            hash.UpdateHash();
            field.MakeMove(startX - 2, startY - 1);
            hash.UpdateHash();

            ulong secondHash = hash.Key;

            Assert.AreEqual(firstHash, secondHash);

            while (field.States.Count() != 0)
            {
                field.UnmakeMove();
                hash.UpdateHash();
            }

            Assert.AreEqual(initKey, hash.Key);
        }
开发者ID:KvanTTT,项目名称:Dots-Game-AI,代码行数:82,代码来源:ZobristHashTest.cs


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