TampliteSK / dragonrose

Weak UCI-compliant chess engine written in C. Based on VICE chess engine by Richard Allbert (Bluefever Software).
GNU General Public License v3.0
2 stars 0 forks source link

compiling v0.25 on Linux : solved (but illegal move) #3

Closed tissatussa closed 2 months ago

tissatussa commented 6 months ago

i just discovered your engine and i was able to compile it on Linux, but i had to change several things in your code (files) :

due to cmake error messages i discovered the compilation must be done inside the build folder .. i did :

$ cmake ../

but then cmake complained it Cannot find source files :

../Source/performance.bin
../Source/xboard.c

so i copied the book file VICEbook.bin into that Source folder and renamed it to performance.bin. when looking into the file CMakeLists.txt (although we should normally not edit it!) and comparing it to the code files, i found you included a file which isn't there and you also forgot some :

set(DRAGONROSE_SOURCES
    "../Source/attack.c"
    "../Source/bitboards.c"
    "../Source/board.c"
    "../Source/data.c"
    "../Source/evaluate.c"
    "../Source/hashkeys.c"
    "../Source/init.c"
    "../Source/io.c"
    "../Source/main.c"
    "../Source/makemove.c"
    "../Source/misc.c"
    "../Source/movegen.c"
    "../Source/perft.c"
    "../Source/polybook.c"
    "../Source/polykeys.c"
    "../Source/pvtable.c"
    "../Source/search.c"
    "../Source/tinycthread.c"  << ADD this line
    "../Source/uci.c"
    "../Source/validate.c"
    "../Source/xboard.c"       << REMOVE this line
)

set(DRAGONROSE_HEADERS
    "../Source/defs.h"
    "../Source/attack.h"
    "../Source/polykeys.h"
    "../Source/tinycthread.h"  << ADD this line
)

after these changes the compilation went well (doing cmake ../ and then make) and i get a working binary of 112.8 Kb. NOTE: a makefile in /Source exists, but it's not needed - it can also be removed.


then i let this v0.25 play games against another engine (in CuteChess GUI), but it fails immediately by making an illegal move .. this happened with White and Black :

Dragonrose-v0 25-illegal-move

log tail :

[...]
<Eccat v0.1.2(2): info depth 13 seldepth 30 time 8655 score cp 22 nodes 25830312 nps 2984316 hashfull 303 pv b8c6 f1c4 g7g6 h5d1 f8g7 g1f3 g8f6 b1c3 f6e4 c4f7 e8f7 c3e4 d7d5 e4g5 f7g8 e1h1
<Eccat v0.1.2(2): info depth 14 seldepth 38 time 22461 score cp 22 nodes 64125216 nps 2854905 hashfull 535 pv b8c6 f1c4 g7g6 h5d1 f8g7 g1f3 g8f6 b1c3 f6e4 c4f7 e8f7 c3e4 d7d5 e4g5 f7g8 e1h1
<Eccat v0.1.2(2): bestmove b8c6
>Dragonrose v0.25(1): position startpos moves e2e4 e7e5 d1h5 b8c6
>Dragonrose v0.25(1): isready
<Dragonrose v0.25(1): Game Board:
<Dragonrose v0.25(1): 8    r  n  b  q  k  b  n  r
<Dragonrose v0.25(1): 7    p  p  p  p  .  p  p  p
<Dragonrose v0.25(1): 6    .  .  .  .  .  .  .  .
<Dragonrose v0.25(1): 5    .  .  .  .  p  .  .  Q
<Dragonrose v0.25(1): 4    .  .  .  .  P  .  .  .
<Dragonrose v0.25(1): 3    .  .  .  .  .  .  .  .
<Dragonrose v0.25(1): 2    P  P  P  P  .  P  P  P
<Dragonrose v0.25(1): 1    R  N  B  .  K  B  N  R
<Dragonrose v0.25(1):      a  b  c  d  e  f  g  h
<Dragonrose v0.25(1): side:b
<Dragonrose v0.25(1): enPas:99
<Dragonrose v0.25(1): castle:KQkq
<Dragonrose v0.25(1): PosKey:15A45136F5247349
<Dragonrose v0.25(1): readyok
>Dragonrose v0.25(1): go wtime 428938 btime 390829 winc 3000 binc 3000
<Dragonrose v0.25(1): Seen Go..
<Dragonrose v0.25(1): time:2741 start:1054412931 stop:1054417172 depth:64 timeset:1
<Dragonrose v0.25(1): info score mate -1 depth 1 nodes 1 time 0 pv e8e7
<Dragonrose v0.25(1): bestmove e8e7
>Dragonrose v0.25(1): isready
>Eccat v0.1.2(2): isready
<Dragonrose v0.25(1): readyok
<Eccat v0.1.2(2): readyok

Dragonrose-v0 25-illegal-move2

log tail :

[...]
<Eccat v0.1.2(3): info depth 11 seldepth 28 time 4813 score cp 100 nodes 14411023 nps 2993889 hashfull 551 pv g1f3 h4d8 d2d4 c7c5 f1d3 g8f6 e1g1 c5d4 f3d4 f8d6 c3b5
<Eccat v0.1.2(3): info depth 12 seldepth 32 time 9048 score cp 103 nodes 26791581 nps 2960795 hashfull 585 pv g1f3 h4d8 d2d4 g8f6 f1d3 f8e7 e1g1 e8h8 e4e5 f6d5 d3e4
<Eccat v0.1.2(3): bestmove g1f3
>Dragonrose v0.25(4): position startpos moves e2e4 e7e6 b1c3 d8h4 g1f3
>Dragonrose v0.25(4): isready
<Dragonrose v0.25(4): Game Board:
<Dragonrose v0.25(4): 8    r  n  b  .  k  b  n  r
<Dragonrose v0.25(4): 7    p  p  p  p  .  p  p  p
<Dragonrose v0.25(4): 6    .  .  .  .  p  .  .  .
<Dragonrose v0.25(4): 5    .  .  .  .  .  .  .  .
<Dragonrose v0.25(4): 4    .  .  .  .  P  .  .  q
<Dragonrose v0.25(4): 3    .  .  N  .  .  .  .  .
<Dragonrose v0.25(4): 2    P  P  P  P  .  P  P  P
<Dragonrose v0.25(4): 1    R  .  B  Q  K  B  N  R
<Dragonrose v0.25(4):      a  b  c  d  e  f  g  h
<Dragonrose v0.25(4): side:w
<Dragonrose v0.25(4): enPas:99
<Dragonrose v0.25(4): castle:KQkq
<Dragonrose v0.25(4): PosKey:FBA5587C0B20D01F
<Dragonrose v0.25(4): readyok
>Dragonrose v0.25(4): go wtime 362932 btime 424491 winc 3000 binc 3000
<Dragonrose v0.25(4): Seen Go..
<Dragonrose v0.25(4): time:2542 start:1054694637 stop:1054698679 depth:64 timeset:1
<Dragonrose v0.25(4): info score cp -79 depth 1 nodes 1 time 0 pv e1e2
<Dragonrose v0.25(4): info score cp -79 depth 2 nodes 2 time 0 pv e1e2 b7b6
<Dragonrose v0.25(4): info score cp -79 depth 3 nodes 3 time 0 pv e1e2 b7b6 d2d4
<Dragonrose v0.25(4): info score cp -79 depth 4 nodes 4 time 0 pv e1e2 b7b6 d2d4 g8f6
<Dragonrose v0.25(4): info score cp -79 depth 5 nodes 5 time 0 pv e1e2 b7b6 d2d4 g8f6 g2g3
<Dragonrose v0.25(4): info score cp -79 depth 6 nodes 6 time 0 pv e1e2 b7b6 d2d4 g8f6 g2g3 c8a6
<Dragonrose v0.25(4): info score cp -79 depth 7 nodes 7 time 0 pv e1e2 b7b6 d2d4 g8f6 g2g3 c8a6 e2d2
<Dragonrose v0.25(4): info score cp -79 depth 8 nodes 8 time 0 pv e1e2 b7b6 d2d4 g8f6 g2g3 c8a6 e2d2 f6e4
<Dragonrose v0.25(4): bestmove e1e2
>Eccat v0.1.2(3): isready
>Dragonrose v0.25(4): isready
<Eccat v0.1.2(3): readyok
<Dragonrose v0.25(4): readyok

[ i'm on Xubuntu 22.04 ]

tissatussa commented 6 months ago

btw. the book file VICEbook.bin seems needed when running the engine, not performance.bin ..

TampliteSK commented 6 months ago

Thank you for your message! The engine is producing illegal moves because the magic bitboards aren't working properly yet. I took a bit of a hiatus from developing it and will get back to it soon to debug it. I apologise for not saying so on my page, as I didn't expect people to use it. The “performance.bin" part was something I forgot to change in the makefile, which was careless of me. "VICEbook.bin" is correct. I'm new to git/github so I'm not sure how to remove CMakeFile and stuff without just deleting them locally. I have gitignore but it doesn't seem to do anything about those. I didn't add tinycthreads.c to the makefile as I haven't implemented multithreading yet, so it's not needed for building it.

Anyway, thank you for taking the time to test it out and building it on Linux. I work on Windows and I barely know anything about making it work on Linux. Appreciate the feedback.

tissatussa commented 6 months ago

The engine is producing illegal moves because the magic bitboards aren't working properly yet...

well, then it's clear ..

The “performance.bin" part was something I forgot to change in the makefile, which was careless of me. "VICEbook.bin" is correct.

OK, that's what i thought ..

I'm new to git/github so I'm not sure how to remove CMakeFile and stuff without just deleting them locally. I have gitignore but it doesn't seem to do anything about those.

i understand .. i don't create any program using GitHub, i just find (chess engine) sources and try to compile / use them .. while doing so, i learn a lot and (simple) engines are fun .. authors use different programming languages & module versions and those need their own compilation methods .. i'm only using Linux, but i worked with Window$ for many years .. using GitHub to develop a program is not easy, i know .. some time ago someone showed me how it works and what can be done with it, but i forgot most of it .. if you want to learn -like i do, also now- don't hesitate to contact other programmers, they can easily point you to proper info or even take the time to explain things themself .. maybe you can just ignore that "..removing CMakeFile and stuff.." while developing, only adjust all files when a next working version is ready ?

I didn't add tinycthreads.c to the makefile as I haven't implemented multithreading yet, so it's not needed for building it.

sounds fair, never mind ..

..thank you for taking the time to test it out and building it on Linux. I work on Windows and I barely know anything about making it work on Linux. Appreciate the feedback.

i'm following projects like yours & get notifications by email .. when a new version arrives i will try and test it. Many programmers only use Windows and they don't create 'universal' code which runs on any OS, or they aren't able to test it .. i think it's possible in C to create code which runs anywhere, but it must be hard .. many programmers switch to Rust, which is modern and also gives fast binaries (i think), maybe you'd consider that .. why do you use C and not C++ ? I guess C is fastest though (but hard to code) .. anyway, you should try to use methods & constructs which suit most OS / versions (except 32-bit nowadays).

i can test on Linux anytime, to develop your code - you're welcome .. we'll both learn!

final words for now : you should update the README in any case, not just for users (like me) but also to make things clear for yourself - writing history / changes etc. will help all of us and it clears the mind ..

chess-vh

tissatussa commented 5 months ago

hi, i see you created v0.26 but there's no CMakeLists.txt ? Normally we run just cmake . : it will use that CMakeLists.txt to fully compile a custom binary, Linux in my case.

TampliteSK commented 5 months ago

weird, did .gitignore make it disappear from the repo? I have CMakeLists.txt on my local directory.

TampliteSK commented 5 months ago

should be in release folder. see if it works

tissatussa commented 5 months ago

@TampliteSK as far as i know cmake works like this :

/build       < is created by cmake, and/or is empty
/.cache      < is not needed (leftover from your own installation ?)
/CMakeFiles  < is created by cmake (leftover from your own installation ?)
/Release     < is created by cmake and/or empty
/Source      < should not contain a makefile, that is (re)created by cmake
/.vscode     < on Linux i don't use this

CMakeCache.txt       < leftover from your own installation ?
cmake_install.cmake  < leftover from your own installation ?

CMakeLists.txt       <<<<< i expect this file here, but it isn't

.gitignore
LICENSE
README.md
TampliteSK commented 5 months ago

Pushed a commit, but it looks like /build is some sort of CMake cache. It will generate it every time CMake runs.

tissatussa commented 5 months ago

to compile your source, i think terminal should be in the root of your package, then first thing cmake . does is removing files and folder of a previous build, like emptying /build and deleting /CMakeFiles, but maybe i'm wrong.

tissatussa commented 5 months ago

..but maybe i'm wrong

i mean, i don't know how cmake uses that Cache ..

TampliteSK commented 5 months ago

cmake . just seems to create even more cache files :((