I'm trying to work out how to integrate stockfish (or any UCI compatible engine) into my Android application.
I've downloaded the stockfish Android zip from here: https://stockfishchess.org/download/
Under the Android directory of the zip there are two files:
- stockfish-8-arm64-v8a
- stockfish-8-armeabi-v7a
I have two questions:
- Do I just need to include these two files into my app (and if so where do I put them)? I'm hoping these are pre-built binaries so I don't need to worry about compiling myself.
- How do I call into these files from my android Java code?
Thanks!
1 Answers
Answers 1
Stockfish is written in C++, to call it from a regular Android app written in Java, you need to
- rely on JNI (Java Native Interface, see jni-sample) to do the trick.
After you have learned how to compile Stockfish with JNI, you can interact with the engine via UCI protocol: Here are the UCI Specification.
Then you can call specific methods (e.g. to evaluate a position, or to suggest the best move). It all starts with sending the engine
isready
. If you get an answer, you are on the right track.
It would be far easier to modify an existing project like Droidfish instead of starting from scratch.
0 comments:
Post a Comment