GithubHelp home page GithubHelp logo

vast342 / clarity Goto Github PK

View Code? Open in Web Editor NEW
35.0 3.0 5.0 26.08 MB

UCI chess engine with NNUE evaluation

License: GNU General Public License v3.0

CMake 1.07% C++ 97.56% C 0.79% Makefile 0.58%
chess chess-engine engine-development uci uci-chess-engine cpp

clarity's People

Contributors

vast342 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clarity's Issues

Wrong version number

Please correct the version number displayed by version 2.0.0. It says it is version 1.0.2.

Crashes on quit

Engine crashes when exiting - threads not cleaned up properly.

changing all instances of std::thread with std::jthread fixes the problem.

JA.

compile on Linux OK after changing some code

in order to compile on Linux, i had to adjust your source a bit (git clone after PR38).
at first i get this error (don't mention my line number 42) :

src/uci.cpp:42:18: error: no member named 'thread' in namespace 'std'
   42 | std::vector<std::thread> threads;

i solved this by adding #include <thread> on top of the uci.cpp file.

then i encountered this error :

/usr/bin/ld: build/wdldatagen.o (symbol from plugin): in function `main':
(.text+0x0): multiple definition of `main'; build/uci.o (symbol from plugin):(.text+0x0): first defined here

i solved it by excluding this main (!?) function in wdldatagen.cpp :

int main([[maybe_unused]]int argc, char** argv) { .. }

after these changes i did make and all went well .. indeed Clarity has threads now and it seems to run fine in CuteChess.

[ i'm on Xubuntu 22.04 ]

v5.0.0 illegal move

in a 900+3 game Clarity v5.0.0 lost without a reason, while it was simply winning : it couldn't mate with just one Rook !?

clarity-5-0-0-illegal-move

here's the game :

[Event "engine vs engine"]
[Site "Holland"]
[Date "2024.02.17"]
[Round "?"]
[White "Winter v2.04b NN"]
[Black "Clarity v5.0.0 NNUE"]
[Result "1/2-1/2"]
[Termination "illegal move"]
[TimeControl "900+3"]
[Opening "Sicilian"]
[ECO "B23"]
[Variation "Closed, 2...Nc6"]

  1. e4 {+0.17/24 43s} c5 {-0.10/31 45s} 2. Nc3 {+0.21/24 49s} Nc6 {-0.08/33 51s} 3. Nf3 {+0.23/22 47s} e5 {-0.20/35 55s} 4. Bc4 {+0.24/22 26s} d6 {-0.23/34 48s} 5. O-O {+0.24/25 31s} Be7 {-0.15/34 33s} 6. Nd5 {+0.22/22 42s} Nf6 {-0.19/35 38s} 7. Re1 {+0.18/21 35s} Nxd5 {-0.14/34 40s} 8. exd5 {+0.25/21 21s} Nd4 {-0.08/33 24s} 9. Nxd4 {+0.16/23 37s} cxd4 {-0.08/30 19s} 10. a4 {+0.14/22 23s} Qc7 {0.00/32 19s} 11. b3 {+0.16/21 24s} O-O {0.00/34 21s} 12. c3 {+0.27/21 28s} dxc3 {0.00/35 67s} 13. dxc3 {+0.18/20 18s} Bd7 {-0.06/30 16s} 14. Bd2 {+0.23/21 18s} Bf6 {0.00/35 82s} 15. Bb5 {+0.31/20 22s} Bd8 {-0.14/32 16s} 16. Bxd7 {+0.23/22 28s} Qxd7 {-0.11/32 13s} 17. a5 {+0.20/22 17s} Rc8 {-0.16/31 23s} 18. c4 {+0.29/20 27s} f5 {-0.24/31 19s} 19. h3 {+0.34/21 14s} h6 {-0.11/26 15s} 20. Ra2 {+0.31/19 25s} Bh4 {-0.18/28 23s} 21. Qh5 {+0.33/19 24s} Be7 {-0.18/29 19s} 22. Qg6 {+0.44/21 19s} Rf6 {0.00/40 82s} 23. Qg3 {+0.28/20 11s} Kh7 {-0.13/30 13s} 24. Qd3 {+0.29/20 22s} Rg6 {0.00/32 7.2s} 25. b4 {+0.18/19 13s} Bh4 {+0.02/28 11s} 26. Rc2 {+0.34/20 18s} e4 {-0.14/27 17s} 27. Qb3 {+0.45/19 19s} b6 {-0.01/28 17s} 28. axb6 {+0.30/18 10s} axb6 {-0.16/25 5.4s} 29. Bf4 {+0.24/18 18s} Re8 {0.00/30 9.8s} 30. Ra2 {+0.27/17 12s} Bg5 {0.00/26 7.5s} 31. Bxg5 {+0.24/18 17s} Rxg5 {0.00/24 6.3s} 32. Rae2 {+0.22/18 16s} Qf7 {0.00/29 7.4s} 33. f4 {+0.12/19 11s} Rg6 {0.00/31 16s} 34. Rc2 {+0.12/21 15s} Ra8 {+0.31/25 5.9s} 35. Kh2 {0.00/24 8.6s} Qe7 {+0.15/30 10s} 36. Rg1 {0.00/23 8.0s} Qa7 {+0.29/25 5.3s} 37. Qc3 {0.00/25 7.2s} Qa3 {+0.20/25 4.6s} 38. g4 {-0.16/21 9.6s} Rf6 {+0.19/26 5.1s} 39. Re1 {-0.14/21 8.5s} Kg6 {+0.34/25 6.3s} 40. Qd4 {-0.33/20 13s} Qd3 {+0.43/24 6.2s} 41. Rd2 {-0.57/20 8.9s} Qxd4 {+0.34/21 4.5s} 42. Rxd4 {-0.57/22 11s} Ra2+ {+0.29/24 4.7s} 43. Kg3 {-0.40/22 11s} Ra3+ {+0.28/21 4.4s} 44. Kg2 {-0.42/22 11s} h5 {+0.62/22 4.4s} 45. gxf5+ {-0.34/21 5.9s} Kxf5 {+0.90/18 3.5s} 46. Rexe4 {-0.15/20 6.1s} Rg6+ {+0.54/19 3.6s} 47. Kf2 {-0.08/23 6.2s} Rxh3 {+0.80/22 4.8s} 48. Re8 {-0.68/20 7.8s} Rh2+ {+0.71/24 4.7s} 49. Kf3 {-0.29/20 5.3s} Rg1 {+0.65/23 5.4s} 50. Rf8+ {-0.97/20 7.8s} Kg6 {+0.54/22 5.3s} 51. f5+ {-0.90/20 9.7s} Kg5 {+0.73/18 3.9s} 52. Rf7 {-0.82/23 5.6s} Rb1 {+0.88/21 5.5s} 53. Rd3 {-1.43/21 9.0s} Rxb4 {+1.10/23 5.7s} 54. Rxg7+ {-2.21/20 4.7s} Kxf5 {+1.27/20 4.6s} 55. Kg3 {-2.14/22 8.8s} Rbb2 {+1.33/23 3.9s} 56. Rf3+ {-1.85/22 6.7s} Ke5 {+1.26/22 3.7s} 57. Re7+ {-2.17/21 4.2s} Kd4 {+1.27/22 3.9s} 58. Rd7 {-1.80/21 8.3s} Rhg2+ {+1.15/24 3.7s} 59. Kh4 {-1.75/17 5.1s} Rg4+ {+1.42/21 6.4s} 60. Kxh5 {-2.77/20 7.9s} Rg8 {+1.44/25 5.4s} 61. Rf4+ {-2.61/22 7.6s} Ke5 {+1.61/22 3.1s} 62. Rh4 {-2.74/27 4.7s} b5 {+1.66/25 3.2s} 63. Kh6 {-3.92/20 7.3s} Rh8+ {+1.68/26 5.3s} 64. Rh7 {-4.78/23 4.5s} Rxh7+ {+1.66/26 3.5s} 65. Kxh7 {-5.12/25 4.8s} b4 {+1.65/25 3.0s} 66. Rh6 {-5.23/25 6.3s} Rd2 {+1.55/24 3.2s} 67. Re6+ {-5.53/27 6.7s} Kd4 {+1.72/23 3.0s} 68. Rxd6 {-5.56/30 4.0s} Kxc4 {+1.74/23 2.8s} 69. Rc6+ {-5.56/30 3.3s} Kxd5 {+1.75/24 4.1s} 70. Rc7 {-5.58/28 4.2s} Kd4 {+1.79/26 3.1s} 71. Rb7 {-6.00/28 3.4s} Kc3 {+1.83/25 2.8s} 72. Kg6 {-6.00/31 6.4s} b3 {+1.89/27 2.9s} 73. Kf5 {-6.00/30 3.5s} Rd4 {+1.85/33 5.1s} 74. Ke5 {-6.13/29 5.4s} Rb4 {+1.80/39 5.3s} 75. Rc7+ {-6.17/28 3.9s} Kd2 {+1.74/32 3.5s} 76. Rd7+ {-6.25/28 3.4s} Ke2 {+1.73/36 5.4s} 77. Rh7 {-6.98/28 3.1s} b2 {+1.71/8 0.017s} 78. Rh2+ {-7.02/24 6.0s} Ke3 {+1.65/34 3.6s} 79. Rh3+ {-17.68/19 5.8s} Kf2 {+1.65/41 4.2s} 80. Rh1 {-M182/22 5.1s} Rb8 {+1.63/49 14s} 81. Rb1 {-6.98/26 5.6s} Ke3 {+1.63/32 2.9s} 82. Kf5 {-17.68/21 3.9s} Kd3 {+1.64/35 5.4s} 83. Ke6 {-17.68/20 3.3s} Kc2 {+1.69/40 7.9s} 84. Rh1 {-M168/22 3.5s} b1=Q {+1.70/27 5.7s} 85. Rxb1 {-M36/28 2.8s} Rxb1 {+1.77/34 2.3s} 86. Kd5 {-M28/32 2.7s} Kd3 {+1.75/30 2.8s} 87. Ke5 {-M26/35 2.7s} Ke3 {+1.73/31 2.6s} 88. Kd5 {-M26/37 3.0s} Rf1 {+1.79/34 5.3s} 89. Kc5 {-M24/40 3.3s} Kf4 {+M33/37 4.2s} 90. Kd4 {-M24/43 3.2s} Rb1 {+1.73/32 3.9s} 91. Kc5 {-M24/43 2.7s} Ke4 {+1.74/33 5.3s} 92. Kd6 {-M22/45 3.0s} Rc1 {+M37/40 2.1s} 93. Ke6 {-M22/47 2.7s} Kf4 {+M47/44 4.8s} 94. Kd6 {-M24/46 2.8s} Kf3 {+M43/36 4.8s} 95. Kd5 {-M26/47 2.8s} Rh1 {+1.59/37 3.3s} 96. Kc6 {-M24/47 2.9s} Rd1 {+M37/37 3.1s} 97. Kb5 {-M22/50 3.3s} Rc1 {+M49/43 3.4s} 98. Kb4 {-M20/52 3.4s} Ke4 {+M19/46 2.9s} 99. Kb5 {-M18/53 3.2s} Kd4 {+M9/52 1.9s} 100. Kb6 {-M16/53 2.9s} Kc4 {+M11/35 11s} 101. Kc6 {-M16/54 3.9s} Rd1 {0.00/4 7.2s} 102. Kb6 {-M14/56 3.8s} Kb4 {0.00/4 5.1s} 103. Kc6 {-M14/55 3.9s} Rd2 {0.00/4 4.1s} 104. Kb6 {-M12/57 2.9s, makes an illegal move: a1a1} 1/2-1/2

Compiling v7.2.0 failed : adjust Makefile (solved)

After copying your v7.2.0 source by git clone (PR 107) i got errors when compiling. But i solved them, here's how.

On the CXXFLAGS := ... line you use the option -std=c++20, so this requires a modern clang version. On my OS (Xubuntu 22.04) the default clang version is 14 : i changed that by setting CXX := clang-17.
But this didn't solve some other errors. Looking for answers, even consulting ChatGPT, i found you made a basic mistake : clang++ should be used, in my case clang++-17 !

I also got many (same) warnings argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument].
I discovered this option isn't needed (or is it?) so i safely removed it from the CXXFLAGS := ... line.

Other minor adjustments :

  • LDFLAGS := : this is empty, and used only once, so i removed that also.
  • PGO_DIR isn't defined and also not used (only at clean:), so i removed it.
  • same for pgo-generate (at .PHONY:) : not used, so i removed it.

Besides that, i solved this warning (i only got one) :

src/external/fathom/tbprobe.cpp:2463:41: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
 2463 |   if (popcount(pos->white | pos->black) <= cardinalityDTM) {
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~

like this :

if (static_cast<unsigned int>(popcount(pos->white | pos->black)) <= static_cast<unsigned int>(cardinalityDTM)) {

Maybe i'm mistaken at some points, then please correct me.

After these changes the compilation went well and it created a binary of size 1.7 Mb which runs fine in CuteChess GUI.
And it plays a good game !

Btw. you may look at my ChatGPT session to solve the errors and warnings : https://chatgpt.com/share/93580c50-3ec8-4091-8524-692befc2f184
But this 'conversation' contains lots of useless (?) tries and code constructs, upto to moment i discovered clang++ is needed .. anyhow, this way i learned a lot !

Consider new release file-naming scheme.

Consider using a file-naming scheme for releases that states the overall version of Clarity. It currently isn't possible to discern between different releases of the engine based on file name alone. The v1, v2, v3, v4, etc. structure works, but it needs to clarify which overall engine version is present.

Keeping it separated by micro-architecture levels is good, keep that.

Idea:

  • Clarity_v5.1.0_x86-64-v1.exe

Incompatible With Banksia

With 15 minute time control with Banksia, Clarity will not function properly. The current theory is that this is due to a lack of input acceptance during searches.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.