LCOV - code coverage report
Current view: top level - Source - evalConfig.hpp (source / functions) Coverage Total Hit
Test: coverage Lines: 100.0 % 1 1
Test Date: 2026-03-02 16:42:41 Functions: - 0 0

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include "definition.hpp"
       4              : #include "score.hpp"
       5              : 
       6              : /*!
       7              :  * All parameters for evaluation are defined here
       8              :  * There are const when no esvaluation tuning is use and of course need to be mutable when begin tuned
       9              :  */
      10              : namespace EvalConfig {
      11              : 
      12              : // This idea was taken from the second-degree polynomial material imbalance by Tord Romstad
      13              : extern CONST_EVAL_TUNING EvalScore imbalance_mines[5][5];
      14              : extern CONST_EVAL_TUNING EvalScore imbalance_theirs[5][5];
      15              : 
      16              : extern CONST_EVAL_TUNING EvalScore PST[PieceShift][NbSquare];
      17              : 
      18              : extern CONST_EVAL_TUNING EvalScore pawnShieldBonus;
      19              : extern CONST_EVAL_TUNING EvalScore pawnFawnMalusKS;
      20              : extern CONST_EVAL_TUNING EvalScore pawnFawnMalusQS;
      21              : extern CONST_EVAL_TUNING EvalScore passerBonus[8];
      22              : extern CONST_EVAL_TUNING EvalScore rookBehindPassed;
      23              : extern CONST_EVAL_TUNING EvalScore kingNearPassedPawnSupport[8][8];
      24              : extern CONST_EVAL_TUNING EvalScore kingNearPassedPawnDefend[8][8];
      25              : enum PawnEvalSemiOpen { Close = 0, SemiOpen = 1 };
      26              : 
      27              : extern CONST_EVAL_TUNING EvalScore doublePawn[8][2];
      28              : extern CONST_EVAL_TUNING EvalScore isolatedPawn[8][2];
      29              : extern CONST_EVAL_TUNING EvalScore backwardPawn[8][2];
      30              : extern CONST_EVAL_TUNING EvalScore detachedPawn[8][2];
      31              : 
      32              : extern CONST_EVAL_TUNING EvalScore holesMalus;
      33              : extern CONST_EVAL_TUNING EvalScore pieceFrontPawn;
      34              : extern CONST_EVAL_TUNING EvalScore pawnFrontMinor[8];
      35              : extern CONST_EVAL_TUNING EvalScore outpostN;
      36              : extern CONST_EVAL_TUNING EvalScore outpostB;
      37              : extern CONST_EVAL_TUNING EvalScore centerControl;
      38              : extern CONST_EVAL_TUNING EvalScore knightTooFar[8];
      39              : extern CONST_EVAL_TUNING EvalScore candidate[8];
      40              : extern CONST_EVAL_TUNING EvalScore protectedPasserBonus[8];
      41              : extern CONST_EVAL_TUNING EvalScore freePasserBonus[8];
      42              : extern CONST_EVAL_TUNING EvalScore pawnMobility;
      43              : extern CONST_EVAL_TUNING EvalScore pawnSafeAtt;
      44              : extern CONST_EVAL_TUNING EvalScore pawnSafePushAtt;
      45              : extern CONST_EVAL_TUNING EvalScore pawnlessFlank;
      46              : extern CONST_EVAL_TUNING EvalScore pawnStormMalus;
      47              : extern CONST_EVAL_TUNING EvalScore rookOnOpenFile;
      48              : extern CONST_EVAL_TUNING EvalScore rookOnOpenSemiFileOur;
      49              : extern CONST_EVAL_TUNING EvalScore rookOnOpenSemiFileOpp;
      50              : 
      51              : extern CONST_EVAL_TUNING EvalScore rookQueenSameFile;
      52              : extern CONST_EVAL_TUNING EvalScore rookFrontQueenMalus;
      53              : extern CONST_EVAL_TUNING EvalScore rookFrontKingMalus;
      54              : extern CONST_EVAL_TUNING EvalScore minorOnOpenFile;
      55              : 
      56              : extern CONST_EVAL_TUNING EvalScore pinnedKing[5];
      57              : extern CONST_EVAL_TUNING EvalScore pinnedQueen[5];
      58              : 
      59              : extern CONST_EVAL_TUNING EvalScore hangingPieceMalus;
      60              : 
      61              : extern CONST_EVAL_TUNING EvalScore threatByMinor[6];
      62              : extern CONST_EVAL_TUNING EvalScore threatByRook[6];
      63              : extern CONST_EVAL_TUNING EvalScore threatByQueen[6];
      64              : extern CONST_EVAL_TUNING EvalScore threatByKing[6];
      65              : 
      66              : extern CONST_EVAL_TUNING EvalScore adjKnight[9];
      67              : extern CONST_EVAL_TUNING EvalScore adjRook[9];
      68              : extern CONST_EVAL_TUNING EvalScore badBishop[9];
      69              : extern CONST_EVAL_TUNING EvalScore bishopPairBonus[9];
      70              : extern CONST_EVAL_TUNING EvalScore knightPairMalus;
      71              : extern CONST_EVAL_TUNING EvalScore rookPairMalus;
      72              : extern CONST_EVAL_TUNING EvalScore queenNearKing;
      73              : 
      74              : //N B R QB QR K
      75              : extern CONST_EVAL_TUNING EvalScore MOB[6][15];
      76              : 
      77              : // This is of course Stockfish inspired
      78              : extern CONST_EVAL_TUNING EvalScore initiative[4];
      79              : 
      80              : // scaling (/128.f inside eval)
      81              : extern CONST_EVAL_TUNING ScoreType scalingFactorWin;
      82              : extern CONST_EVAL_TUNING ScoreType scalingFactorHardWin;
      83              : extern CONST_EVAL_TUNING ScoreType scalingFactorLikelyDraw;
      84              : 
      85              : extern CONST_EVAL_TUNING ScoreType scalingFactorOppBishopAlone;
      86              : extern CONST_EVAL_TUNING ScoreType scalingFactorOppBishopAloneSlope;
      87              : extern CONST_EVAL_TUNING ScoreType scalingFactorOppBishop;
      88              : extern CONST_EVAL_TUNING ScoreType scalingFactorOppBishopSlope;
      89              : extern CONST_EVAL_TUNING ScoreType scalingFactorQueenNoQueen;
      90              : extern CONST_EVAL_TUNING ScoreType scalingFactorQueenNoQueenSlope;
      91              : extern CONST_EVAL_TUNING ScoreType scalingFactorPawns;
      92              : extern CONST_EVAL_TUNING ScoreType scalingFactorPawnsSlope;
      93              : extern CONST_EVAL_TUNING ScoreType scalingFactorPawnsOneSide;
      94              : 
      95              : // This idea was taken from Topple by Vincent Tang a.k.a Konsolas
      96              : enum katt_att_def : uint8_t { katt_attack = 0, katt_defence = 1 };
      97              : extern CONST_EVAL_TUNING ScoreType kingAttMax;
      98              : extern CONST_EVAL_TUNING ScoreType kingAttTrans;
      99              : extern CONST_EVAL_TUNING ScoreType kingAttScale;
     100              : extern CONST_EVAL_TUNING ScoreType kingAttOffset;
     101              : extern CONST_EVAL_TUNING ScoreType kingAttWeight[2][6];
     102              : extern CONST_EVAL_TUNING ScoreType kingAttSafeCheck[6];
     103              : extern CONST_EVAL_TUNING ScoreType kingAttOpenfile;
     104              : extern CONST_EVAL_TUNING ScoreType kingAttSemiOpenfileOpp;
     105              : extern CONST_EVAL_TUNING ScoreType kingAttSemiOpenfileOur;
     106              : extern CONST_EVAL_TUNING ScoreType kingAttNoQueen;
     107              : extern ScoreType                   kingAttTable[64];
     108              : 
     109              : extern CONST_EVAL_TUNING ScoreType tempo;
     110              : 
     111              : // from 0 to m with offset, translation and scale
     112              : [[nodiscard]] FORCE_FINLINE double sigmoid(double x, double m = 1.f, double trans = 0.f, double scale = 1.f, double offset = 0.f) {
     113         1408 :    return m / (1 + std::exp((trans - x) / scale)) - offset;
     114              : }
     115              : 
     116              : void initEval();
     117              : 
     118              : } // namespace EvalConfig
        

Generated by: LCOV version 2.0-1