jakhac / chai

UCI compatible chess engine playing at estimated ~2400 elo
MIT License
5 stars 1 forks source link

how to use Perft ? #4

Open tissatussa opened 1 year ago

tissatussa commented 1 year ago

hi, your README states Chai can do Perft .. it also states "..Each run contains statistics about captures, checks, mates.." which seems interesting to me .. how can i execute a Perft command ? Known UCI engines like SF can do eg. go perft 6 but this doesn't work with Chai ..

jakhac commented 1 year ago

Immediately after starting the engine in cli (do not type uci!), there are two options:

Since I am not aware of any GUIs that have a perft option and I only use it for debugging, the perft command is not implemented inside the UCI protocol. However, I could also make it accessible as go perft if needed..

tissatussa commented 1 year ago

Thanks for explaining how to use your Perft function. Yes, for convenience, you can implement go perft # like SF does, although it's not part of the (unofficial!?) UCI protocol. Btw. i only use Perft in terminal, no need for GUI :-)

tissatussa commented 1 year ago

i did this test :

chai v3.4.2
assert=0 buckets=3 threads=1/2 hashMb=256 simd=AVX2
compiler=gnu 11.3.0 date=Dec 23 2022

position fen rnbqk2r/ppp2ppp/4pb2/8/3PN3/5N2/PPP2PPP/R2QKB1R b KQkq - 0 7

indeed position fen is an UCI command and uci was not yet executed .. i got this message :

Error: bad command. Valid commands are:
    - uci           (start uci protocol)
    - <e2e4>        (apply move)
    - pop           (undo move)
    - fen <KQP/34KR/...>    (parse a fen)
    - perft <d>     (perft to depth d)
    - fperft <d>        (fast-perft to depth d using all available cores)
    - info          (print engine info)
    - quit          (exit program)

so i did fen <..> and then perft # and it works! i found a few other scripts & codes which have such statistics with Perft .. i was thinking about some math tests with those numbers to determine some unknown logic .. shall i tell more ? Are you interested ? I know Perft is mainly for testing a move generator, but with those statistics ?

jakhac commented 1 year ago

These commands

    - uci           (start uci protocol)
    - <e2e4>        (apply move)
    - pop           (undo move)
        ...

are mainly used to assist debugging and are not part of any protocol. So you can either use them as described or drop into the UCI protocol via uci.