As I continue to work on my java chess engine for Android, I’ve decided on a name for it, “beginner chess engine”. I just posted the latest commits here:
It’s not quite finished yet, and still needs more adjusting, changing, and tweaking. A large portion of the engine is based off of Logic Crazy’s tutorial on building chess engines. I have made some modifications and adjustments, mainly to get it working in Android, but also some adjustments of the engine parameters. I will be making more adjustments as time goes on.
So far, here is what the engine allows you to do:
Using the command in the MainActivity.java file, you can request the list of possible moves, as well as the alpha-beta determined next best move.
The move possibilities are handled in the thinktank.java file, and the rating.java file handles the rating, or score, of each move. The userinterface.java file controls moving the pieces and drawing the board.
Here are the current problems:
-Castle, currently to castle is not a move possibility.
-Promotion, currently, the pawns can capture and advance to the final row, but I need to fix the promotion to another piece.
-There is something wrong with knowing the king is in check. The engine knows the king is not safe, but it doesn’t have a problem with the fact that the king could be killed. Obviously, that is not right.
And here are some of my goals for this engine:
-To allow moves to be entered by standard notation.
-To report moves in standard notation.
-To allow time determined moves.
-To fix the problems. (Obviously)
-To allow engine control by standard international chess engine commands.
-To allow user adjustment controls.
-To provide an open source chess engine for other Android chess developers or game makers.
-To have fun, and learn more about chess!
So far, I’ve built the app that you can grab from the repository that is literally just a visual way to test the engine. As you can see, you can adjust the ply, and have the engine make the next move.
Warning: Every ply is a multiple of available moves, averaging about 20. So 4 ply is 160000 moves to calculate in the alpha beta tree. Most cell phones that I have can only calculate 3 ply without crashing. In the Android Studio AVD manager, I can load up the emulator and calculate about 6 ply. Hopefully I can streamline the process a bit so it takes less power to calculate.
Also, the more ply, the longer it takes to think. So, on my Galaxy S4, 2 ply takes about 8 – 10 seconds, and 3 ply takes 30 – 60 seconds, with 4 ply (if it doesn’t crash) taking up to 3 minutes.
Hope you enjoy the engine, and hopefully I can one day get it polished enough for gamers to use!
Linux – keep it simple.