libchess any good ?

Discussion of chess software programming and technical issues.

Moderator: Ras

Carbec
Posts: 162
Joined: Thu Jan 20, 2022 9:42 am
Location: France
Full name: Philippe Chevalier

libchess any good ?

Post by Carbec »

Hello

I am trying to use bitboards in my chess engine. And I found this :
https://github.com/kz04px/libchess

Do you know/use this library ?
Is there also some example of bitboard utilisation?

Thanks a lot

Carbec
clayt
Posts: 29
Joined: Thu Jun 09, 2022 5:09 am
Full name: Clayton Ramsey

Re: libchess any good ?

Post by clayt »

It seems like a decent implementation of chess. However, most people roll their own implementation of the rules of chess from scratch (generally for both performance and extensibility reasons), so it's rare to rely on someone else's library for that. I took a peek at the code and it all seems pretty sensibly implemented, so it would be a good reference while writing your own engine from scratch in C++.
User avatar
flok
Posts: 558
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: libchess any good ?

Post by flok »

Carbec wrote: Wed Nov 02, 2022 9:12 pm Hello

I am trying to use bitboards in my chess engine. And I found this :
https://github.com/kz04px/libchess

Do you know/use this library ?
Is there also some example of bitboard utilisation?

Thanks a lot

Carbec
It's very good. For my (new) programs I use https://github.com/Mk-Chan/libchess though (my older programs had self-written move-gen).
chesskobra
Posts: 348
Joined: Thu Jul 21, 2022 12:30 am
Full name: Chesskobra

Re: libchess any good ?

Post by chesskobra »

Could someone explain the difference between the libraries by Mk-chan, folkertvanheusden and kz04px?
Mike Sherwin
Posts: 965
Joined: Fri Aug 21, 2020 1:25 am
Location: Planet Earth, Sol system
Full name: Michael J Sherwin

Re: libchess any good ?

Post by Mike Sherwin »

I have been trying to compile the perft.cpp example from libchess all day. I'm done trying. Can someone else compile it and maybe some of the other examples as well. And make the exe available somewhere. Or at the very least report perft 6 time for the starting position. Also please give cpu and cpu speed.
User avatar
Ras
Posts: 2696
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: libchess any good ?

Post by Ras »

Mike Sherwin wrote: Sat Nov 12, 2022 10:42 pmI have been trying to compile the perft.cpp example from libchess all day. I'm done trying.
Assuming you mean https://github.com/kz04px/libchess, just follow the build instructions. Easy, at least under Linux. Ofc, cmake and make have to be installed, not just the compiler.
And make the exe available somewhere.
I don't know how to cross-build that for Windows as I'm on Linux.
Or at the very least report perft 6 time for the starting position. Also please give cpu and cpu speed.
Here the output from perft 7 on my Ryzen 7 5700G. Configured down to 45W, but singlethread boost is still the normal 4.6GHz, and the program seems to use a single thread as per my system monitor. For reference, Stockfish 15 needs 12s for perft 7 on this PC.

Code: Select all

rnbqkbnr
pppppppp
--------
--------
--------
--------
PPPPPPPP
RNBQKBNR
Castling: KQkq
EP: -
Turn: w

depth 0 time 0 nodes 1
depth 1 time 0 nodes 20
depth 2 time 0 nodes 400
depth 3 time 0 nodes 8902
depth 4 time 2 nodes 197281 nps 98640000
depth 5 time 38 nodes 4865609 nps 128042000
depth 6 time 747 nodes 119060324 nps 159384000
depth 7 time 19092 nodes 3195901860 nps 167394000
Rasmus Althoff
https://www.ct800.net
Mike Sherwin
Posts: 965
Joined: Fri Aug 21, 2020 1:25 am
Location: Planet Earth, Sol system
Full name: Michael J Sherwin

Re: libchess any good ?

Post by Mike Sherwin »

Ras wrote: Sat Nov 12, 2022 11:23 pm
Mike Sherwin wrote: Sat Nov 12, 2022 10:42 pmI have been trying to compile the perft.cpp example from libchess all day. I'm done trying.
Assuming you mean https://github.com/kz04px/libchess, just follow the build instructions. Easy, at least under Linux. Ofc, cmake and make have to be installed, not just the compiler.
And make the exe available somewhere.
I don't know how to cross-build that for Windows as I'm on Linux.
Or at the very least report perft 6 time for the starting position. Also please give cpu and cpu speed.
Here the output from perft 7 on my Ryzen 7 5700G. Configured down to 45W, but singlethread boost is still the normal 4.6GHz, and the program seems to use a single thread as per my system monitor. For reference, Stockfish 15 needs 12s for perft 7 on this PC.

Code: Select all

rnbqkbnr
pppppppp
--------
--------
--------
--------
PPPPPPPP
RNBQKBNR
Castling: KQkq
EP: -
Turn: w

depth 0 time 0 nodes 1
depth 1 time 0 nodes 20
depth 2 time 0 nodes 400
depth 3 time 0 nodes 8902
depth 4 time 2 nodes 197281 nps 98640000
depth 5 time 38 nodes 4865609 nps 128042000
depth 6 time 747 nodes 119060324 nps 159384000
depth 7 time 19092 nodes 3195901860 nps 167394000
All I needed were the nodes per second. Thanks!
Carbec
Posts: 162
Joined: Thu Jan 20, 2022 9:42 am
Location: France
Full name: Philippe Chevalier

Re: libchess any good ?

Post by Carbec »

Hello,

This is the result on my PC under windows 10, compiled with QtCreator. The compiler is mingw.
Its an old one : Intel Core i7-2600K with Sandy Bridge-DT XE).

Code: Select all

rnbqkbnr
pppppppp
--------
--------
--------
--------
PPPPPPPP
RNBQKBNR
Castling: KQkq
EP: -
Turn: w

depth 0 time 0 nodes 1
depth 1 time 0 nodes 20
depth 2 time 0 nodes 400
depth 3 time 0 nodes 8902
depth 4 time 5 nodes 197281 nps 39456000
depth 5 time 77 nodes 4865609 nps 63189000
depth 6 time 1731 nodes 119060324 nps 68781000
depth 7 time 43125 nodes 3195901860 nps 74107000