コード例 #1
0
ファイル: Generic11x8.cs プロジェクト: ColinSuess/ChessVFork
        public override void AddEvaluations()
        {
            base.AddEvaluations();

            //	Outpost Evaluations
            if ((Knight != null && Knight.Enabled) ||
                (Bishop != null && Bishop.Enabled))
            {
                OutpostEval = new OutpostEvaluation();
                if (Knight != null && Knight.Enabled)
                {
                    OutpostEval.AddOutpostBonus(Knight);
                }
                if (Bishop != null && Bishop.Enabled)
                {
                    OutpostEval.AddOutpostBonus(Bishop, 10, 2, 5, 5);
                }
                AddEvaluation(OutpostEval);
            }

            //	Rook-type Evaluations (rook-mover on open file
            //	and rook-mover on 7th ranks with enemy king on 8th)

            //	Do we have a royal king?
            CheckmateRule rule      = (CheckmateRule)FindRule(typeof(CheckmateRule));
            bool          royalKing = rule != null && King != null && King.Enabled && rule.RoyalPieceType == King;

            if ((Rook != null && Rook.Enabled) ||
                (Queen != null && Queen.Enabled && royalKing))
            {
                RookTypeEval = new RookTypeEvaluation();
                if (Rook != null && Rook.Enabled)
                {
                    RookTypeEval.AddOpenFileBonus(Rook);
                    if (royalKing)
                    {
                        RookTypeEval.AddRookOn7thBonus(Rook, King);
                    }
                }
                if (Queen != null && Queen.Enabled && royalKing)
                {
                    RookTypeEval.AddRookOn7thBonus(Queen, King, 2, 8);
                }
                AddEvaluation(RookTypeEval);
            }
        }
コード例 #2
0
        public override void Initialize(Game game)
        {
            base.Initialize(game);
            hashKeyIndex            = game.HashKeys.TakeKeys(4);
            searchStateHistory      = new int[Game.MAX_GAME_LENGTH + Game.MAX_PLY];
            searchStateHistoryIndex = 0;
            searchStateHistory[searchStateHistoryIndex++] = currentState;

            //	Determine royal piece type (if any)
            CheckmateRule checkmateRule = (CheckmateRule)game.FindRule(typeof(CheckmateRule), true);

            if (checkmateRule != null)
            {
                RoyalPieceType = checkmateRule.RoyalPieceType;
                royalPieces    = new Piece[game.NumPlayers];
            }
        }