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

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include "definition.hpp"
       4              : 
       5              : struct Position;
       6              : 
       7              : /*!
       8              :  * This KPK implementation idea was taken from public-domain code from H.G. Muller
       9              :  * http://talkchess.com/forum3/viewtopic.php?f=7&t=47557#p511740
      10              :  */
      11              : namespace KPK {
      12              : 
      13              : #if !defined(WITH_SMALL_MEMORY)
      14              : [[nodiscard]] Square normalizeSquare(const Position& p, const Color strongSide, const Square sq);
      15              : 
      16              : enum kpk_result : uint8_t { kpk_invalid = 0, kpk_unknown = 1, kpk_draw = 2, kpk_win = 4 };
      17     80232306 : constexpr kpk_result& operator|=(kpk_result& r, kpk_result v) { return r = kpk_result(r | v); }
      18              : 
      19              : constexpr unsigned KPKmaxIndex = 2 * 24 * NbSquare * NbSquare; // Color x pawn x wk x bk
      20              : 
      21              : struct KPKPosition {
      22              :    KPKPosition() = default;
      23              :    explicit KPKPosition(const unsigned idx);
      24     76111332 :    FORCE_FINLINE operator kpk_result() const { return result; }
      25              :    [[nodiscard]] kpk_result preCompute(const array1d<KPKPosition, KPKmaxIndex>& db);
      26              :    template<Color Us> [[nodiscard]] kpk_result preCompute(const array1d<KPKPosition, KPKmaxIndex>& db);
      27              :    colored<Square> ksq;
      28              :    Square psq;
      29              :    kpk_result result;
      30              :    Color us;
      31              : };
      32              : 
      33              : [[nodiscard]] bool probe(const Square wksq, const Square wpsq, const Square bksq, const Color us);
      34              : #endif
      35              : 
      36              : void init();
      37              : 
      38              : } // namespace KPK
        

Generated by: LCOV version 2.0-1