Пример #1
0
        public static StringBuilder AppendCastleRights(
            this StringBuilder sb, HiFlags fBlackHi, HiFlags fWhiteHi, CastleRule castle)
        {
            if (((fBlackHi | fWhiteHi) & HiFlags.CanCastleMask) == 0)
            {
                sb.Append("-");
            }
            else if (castle is not null && castle.IsChess960)
            {
                var ruleWhite = castle.RuleParameter[White];
                if ((fWhiteHi & HiFlags.CanOO) != 0 && ruleWhite.RookOOFrom.HasValue)
                {
                    sb.Append((Char)('A' + ruleWhite.RookOOFrom));
                }
                if ((fWhiteHi & HiFlags.CanOOO) != 0 && ruleWhite.RookOOOFrom.HasValue)
                {
                    sb.Append((Char)('A' + ruleWhite.RookOOOFrom));
                }

                var ruleBlack = castle.RuleParameter[Black];
                if ((fBlackHi & HiFlags.CanOO) != 0 && ruleBlack.RookOOFrom.HasValue)
                {
                    sb.Append((Char)('a' + ruleBlack.RookOOFrom - nRankLast));
                }
                if ((fBlackHi & HiFlags.CanOOO) != 0 && ruleBlack.RookOOOFrom.HasValue)
                {
                    sb.Append((Char)('a' + ruleBlack.RookOOOFrom - nRankLast));
                }
            }
Пример #2
0
        public GameState(ICommand Command)
        {
            if (Command is null)
            {
                throw new ArgumentNullException("Command");
            }

            this.Command = Command;

            //
            //[ToDo]Allocate a separate Pool of positions for each thread:
            //
            PositionPool = new Pool <Position>();

            Bound = new SearchBound();
            Rule  = new CastleRule();
            Case  = new PerfCase();

            newBestMoves(wDepthMax);
            newTimers();
            SeededRandom = new Random(); // Variable seed based on Environment.TickCount

            loadEndgameValue();
            loadExtensionLimit();
#if KillerCompositionHash
            var uBottleLength = 8191U;
#else
            var uBottleLength = wPlyHistory;
#endif
#if UseKillers
            Bottle = new MoveBottle(uBottleLength);
#endif                                  // UseKillers
            wireControls();

            newNodeDelta(wDepthMax);
            newEarlyMoveCounts(wPlyHistory);
            newPVDoubleCounts(wPlyHistory);
#if MaterialBalance
            newCXPMemo(uDefaultComposition2);
#else
            newCXPMemo(uDefaultCompositions);
#endif
            newPXPMemo(uDefaultPawnPositions);

            //clear();
        }