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


C# Playfield.printBoard方法代码示例

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


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

示例1: getMove

        public override Action getMove()
        {
            bestValue = float.MinValue;
            bestBoard = new Playfield(board);
            currentState = new Node(board, null, 0);

            if (expand(currentState) == 1) return null; // no moves
            bool isEndReachedBefore = isEndReached;
            for (int i = 0; i < 500; i++)
            {
                //Helpfunctions.Instance.logg("try: " + i);
                //counter++;
                //if (counter == 10) {
                //    Helpfunctions.Instance.logg("try: " + i);
                //    counter = 0;
                //}
                //if (i == 752) {
                //    int debug = 1;
                //}
                if (isEndReachedBefore != isEndReached)
                {
                    //Helpfunctions.Instance.logg("try: " + i + " reach");
                    break;
                }
                else
                {
                    //Helpfunctions.Instance.logg("try: " + i + " not reach");
                }
                UCTRun(currentState, 0.7f);
                //currentState.state = new Playfield(board);
            }

            if (isEndReachedBefore != isEndReached)
            {
                currentState = new Node(board, null, 0);

                if (expand(currentState) == 1) return null; // no moves
                for (int i = 0; i < 10000; i++)
                {
                    UCTRun(currentState, 0.7f);
                    currentState.state = new Playfield(board);
                }
            }

            int maxVisit = 0;
            Action selectedMove = null;
            Node selectedChild = null;
            foreach (Node child in currentState.children)
            {
                //child.move.print();
                //Helpfunctions.Instance.logg("count = " + child.numVisited);
                if (child.numVisited > maxVisit)
                {
                    maxVisit = child.numVisited;
                    selectedMove = child.move;
                    selectedChild = child;
                }
            }

            //Helpfunctions.Instance.logg("Turn of child:" + selectedChild.state.isOwnTurn);
            //currentState.printChildren();
            Helpfunctions.Instance.logg("best value:" + bestValue);
            bestBoard.printBoard();

            return selectedMove;
        }
开发者ID:shuyi3,项目名称:AIPJ,代码行数:66,代码来源:MCTSPlayer.cs


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