Пример #1
0
        public PVList Calculate(int depth, PVList prevPV, CancellationToken ct, SearchStats searchStats)
        {
            searchDepth      = depth;
            this.searchStats = searchStats;
            this.ct          = ct;
            if (searchDepth > 1 && prevPV != null)
            {
                currentPVNode = prevPV.First;
            }
            PVList pvList = new PVList();
            int    score  = Search(depth, 0, ArtemisEngine.INITIAL_ALPHA, ArtemisEngine.INITIAL_BETA, pvList, false);

            pvList.Score = score;
            pvList.Depth = depth;
            return(pvList);
        }
Пример #2
0
        public PVList Search(int startDepth, CancellationToken ct)
        {
            SearchStats = new SearchStats();
            killerMoves.Prepare(gameState.IrrevStates);
            PVList pv = null;
            bool   con;
            int    depth = startDepth;

            do
            {
                PVList newPV = pvSearch.Calculate(depth, pv, ct, SearchStats);
                if (!ct.IsCancellationRequested)
                {
                    pv = newPV;
                }
                depth++;
                con = !ct.IsCancellationRequested && (!config.ConstantDepth || depth <= config.Depth);
            } while (con);

            return(pv);
        }