Example #1
0
        public ThreadedSolver(int numThreads, double ttSize)
        {
            table = new TranspositionTable(gbytes: ttSize);
            var locker = new MoveLocker();

            solvers = new List <Solver>();

            for (int i = 0; i < numThreads; i++)
            {
                solvers.Add(new Solver(table, locker));
            }
        }
Example #2
0
        public Solver(TranspositionTable table, MoveLocker locker = null)
        {
            // Parameters

            this.table  = table;
            this.locker = locker;

            // Preallocate all the memory. Since the algorithm is recursive,
            // we need one list per depth level to make it re-entrant.
            // We'll never need more that 50 depths, right?

            moveLists = new List <List <Move> >();
            while (moveLists.Count < 50)
            {
                moveLists.Add(new List <Move>());
            }

            quiescenceMoves = new List <List <Move> >();
            while (quiescenceMoves.Count < 50)
            {
                quiescenceMoves.Add(new List <Move>());
            }
        }