Ejemplo n.º 1
0
    public static string do_trace(Position pos)
    {
        std.memset(scores, 0, sizeof(scores));

        Value v = GlobalMembersEvaluate.do_evaluate <true>(pos);

        v = pos.side_to_move() == ((int)Color.WHITE) != 0 ? v : -v;           // White's point of view

        std.stringstream ss = new std.stringstream();
        ss << std.showpoint << std.noshowpos << std.@fixed << std.setprecision(2) << "      Eval term |    White    |    Black    |    Total    \n" << "                |   MG    EG  |   MG    EG  |   MG    EG  \n" << "----------------+-------------+-------------+-------------\n";

        GlobalMembersEvaluate.print(ss, "Material", Terms.MATERIAL);
        GlobalMembersEvaluate.print(ss, "Imbalance", Terms.IMBALANCE);
        GlobalMembersEvaluate.print(ss, "Pawns", PieceType.PAWN);
        GlobalMembersEvaluate.print(ss, "Knights", PieceType.KNIGHT);
        GlobalMembersEvaluate.print(ss, "Bishops", PieceType.BISHOP);
        GlobalMembersEvaluate.print(ss, "Rooks", PieceType.ROOK);
        GlobalMembersEvaluate.print(ss, "Queens", PieceType.QUEEN);
        GlobalMembersEvaluate.print(ss, "Mobility", Terms.MOBILITY);
        GlobalMembersEvaluate.print(ss, "King safety", PieceType.KING);
        GlobalMembersEvaluate.print(ss, "Threats", Terms.THREAT);
        GlobalMembersEvaluate.print(ss, "Passed pawns", Terms.PASSED);
        GlobalMembersEvaluate.print(ss, "Space", Terms.SPACE);

        ss << "----------------+-------------+-------------+-------------\n";
        GlobalMembersEvaluate.print(ss, "Total", Terms.TOTAL);

        ss << "\nTotal Evaluation: " << GlobalMembersEvaluate.to_cp(v) << " (white side)\n";

        return(ss.str());
    }
Ejemplo n.º 2
0
    public static void print(std.stringstream ss, string name, int idx)
    {
        Score wScore = scores[(int)Color.WHITE, idx];
        Score bScore = scores[(int)Color.BLACK, idx];

        switch (idx)
        {
        case Terms.MATERIAL:
        case Terms.IMBALANCE:
        case PieceType.PAWN:
        case Terms.TOTAL:
            ss << std.setw(15) << name << " |   ---   --- |   ---   --- | " << std.setw(5) << GlobalMembersEvaluate.to_cp(GlobalMembersTypes.mg_value(wScore - bScore)) << " " << std.setw(5) << GlobalMembersEvaluate.to_cp(GlobalMembersTypes.eg_value(wScore - bScore)) << " \n";
            break;

        default:
            ss << std.setw(15) << name << " | " << std.noshowpos << std.setw(5) << GlobalMembersEvaluate.to_cp(GlobalMembersTypes.mg_value(wScore)) << " " << std.setw(5) << GlobalMembersEvaluate.to_cp(GlobalMembersTypes.eg_value(wScore)) << " | " << std.setw(5) << GlobalMembersEvaluate.to_cp(GlobalMembersTypes.mg_value(bScore)) << " " << std.setw(5) << GlobalMembersEvaluate.to_cp(GlobalMembersTypes.eg_value(bScore)) << " | " << std.setw(5) << GlobalMembersEvaluate.to_cp(GlobalMembersTypes.mg_value(wScore - bScore)) << " " << std.setw(5) << GlobalMembersEvaluate.to_cp(GlobalMembersTypes.eg_value(wScore - bScore)) << " \n";
            break;
        }
    }