marvk / chess

A chess library, chess engine, Lichess client, and UCI implementation written in Java
https://lichess.org/@/QueensGamBOT
24 stars 7 forks source link

compile a Linux binary ? #25

Open tissatussa opened 6 months ago

tissatussa commented 6 months ago

eg. to use in CuteChess : how to compile Kairuku ?

[ i'm on Xubuntu 22.04 ]

marvk commented 6 months ago

Hi, does CuteChess accept shell scripts as executables? If so it's pretty easy, build the project and make a shsll script running the engine .jar. If not it will become more complicated. Please let me know if you can get it to work, I might be able to provide further assistance like detailed build instructions if you're not familiar with the JVM ecosystem.

tissatussa commented 6 months ago

..if you're not familiar with the JVM ecosystem..

indeed, i'm not into JAVA .. often i find a .jar asset file and i run it by java -jar [jarfile], CuteChess can handle that, although i often create a small run.sh file contaning just that one line - sometimes this is the only way that works for me in CuteChess, i don't know why .jar files differ here ..

note: i'm on Linux ..

marvk commented 6 months ago

Hi, please try kairuku-engine/target/kairuku-engine-1.0.1-SNAPSHOT-jar-with-dependencies.jar

tissatussa commented 6 months ago

Hi, please try kairuku-engine/target/kairuku-engine-1.0.1-SNAPSHOT-jar-with-dependencies.jar

sorry, i don't see that file in the package ..

it contains a pom.xml file, which i can (normally) use to compile a .jar file, but i get errors .. i can supply a log .. do you have a .jar ASSET ?

marvk commented 6 months ago

I thought you were able to compile successfully.

Make sure you have Maven and JDK 11+ installed on your machine.

You might need to do the following steps so that the build will work:

Then, run mvn clean package in the projects root directory. If the build works, the .jar should be present.

tissatussa commented 6 months ago

thanks for this info, now the compilation went well :

$ java -version
openjdk version "21.0.2" 2024-01-16
OpenJDK Runtime Environment (build 21.0.2+13-Ubuntu-122.04.1)
OpenJDK 64-Bit Server VM (build 21.0.2+13-Ubuntu-122.04.1, mixed mode, sharing)

i changed the pom.xml as you wrote and i get your mentioned .jar file, but it malfunctions in CuteChess .. i see the cause when running in terminal :

$ java -jar ./kairuku-engine-1.0.1-SNAPSHOT-jar-with-dependencies.jar
uci
id name kairuku
option name ply type spin default 7 min 1 max 7

compare this output to another (working) .jar :

$ java -jar ./Eubos_v3.5-asset.jar 
uci
id name Eubos 3.5
id author Chris Bolt
option name Hash type spin default 256 min 4 max 4000
option name Threads type spin default 1 min 1 max 4
option name Move Overhead type spin default 10 min 0 max 5000
option name Lazy Threshold type spin default 275 min 0 max 1000
uciok

id name and id author are basic, these lines always appear. and the UCI protocol states the uci command should end with uciok !

tissatussa commented 5 months ago

btw. your code has some uciOK() function but it seems that function is not called .. i'm not into Java though ..

tissatussa commented 5 months ago

did you address the uciok issue yet ? or was i wrong about that ?

marvk commented 5 months ago

I think I fixed that at some point, locally when using the engine to play my new engine. Need to get that off an old HDD though, I'll hit you up when I get around to it.

marvk commented 4 months ago

@tissatussa Hi, just pushed the fix, please check again.

tissatussa commented 4 months ago

..just pushed the fix, please check again..

congrats ! i just compiled the newest source and all went well : after i did the same changes in those pom.xml files, i get a valid jar file (4.6 Mb) and indeed it does uciok ! CuteChess is happy now and Kairuku won its first game !

i propose you update those pom.xml files and give Kairuku a version number. it would also be convenient to supply a .jar asset for download.

btw. the dates of your source file(s) didn't change on GitHub, so it's not clear you made this fix .. how does this work ? (i've no experience with PR's etc.)

tissatussa commented 4 months ago

i let Kairuku play a few games and suddenly it had a disconnection in CuteChess GUI :

kairuku-disconnect

here's the concerning ZIPped log file : chess.2024-06-22-06-19-52.zip


[Event "engine vs engine"]
[Site "Holland"]
[Date "2024.06.22"]
[Round "?"]
[White "Kairuku"]
[Black "Koedem v1.1.2"]
[Result "0-1"]
[ECO "B07"]
[GameDuration "00:06:52"]
[Opening "Pirc defense"]
[PlyCount "24"]
[Termination "abandoned"]
[TimeControl "300+10"]

1. e4 {+0.35/7 8.2s} d6 {-0.22/8 8.7s} 2. d4 {+0.45/7 3.8s} Nf6 {-0.27/8 9.9s}
3. Nc3 {+0.50/7 2.1s} Nc6 {-0.34/8 20s} 4. Bb5 {+0.60/7 11s} Bd7 {-0.28/9 63s}
5. Bxc6 {+0.55/7 6.7s} Bxc6 {-0.04/9 12s} 6. d5 {+0.55/7 3.1s} Bd7 {+0.09/9 42s}
7. Qd3 {+0.50/7 5.2s} g6 {+0.08/8 19s} 8. Qc4 {+0.65/7 22s} Bg7 {+0.16/8 8.3s}
9. Nf3 {+0.60/7 22s} O-O {+0.10/8 14s} 10. Qb3 {+0.50/7 7.0s} Rb8 {+0.25/8 25s}
11. Be3 {+0.75/7 8.1s} c5 {+0.32/8 14s} 12. Ng5 {+0.55/7 25s}
b5 {+1.17/8 21s, White disconnects} 0-1