Sometimes, you just have to step out in a new direction. In the 1920’s, chess players began to hold to a new style of play, then called hypermodernism. In this phase, conventional moves were called into question, and they began to invent interesting new ways to control the center of the board, without moving the king’s or queen’s pawns. Similarly, I need to re-evaluate the beginner’s chess engine. Question the conventional method that I am currently using, and step out in a new direction. Is that good or bad? Only time will tell.
While writing the Beginner’s Chess Engine, I came to realize that there were a lot of changes that needed to be made to that engine to really speed it up. These changes would be extremely time consuming to implement by direct editing, and called for a whole new engine scheme. Again, I wanted to create a chess engine that was open source, for anyone to use, as well as keep it simple, small, and workable for Android cell phones. Thus enter the JustChessEngine.
Ironically, if you build it from the repository, it will look identical to the Beginner Chess Engine graphically, as I used the same graphical material to create it. However, under the hood is a whole new animal.
You can check out the new repository at https://github.com/alaskalinuxuser/JustChessEngine.
The big change from the git-go is ditching the array of string arrays that make up the board. Arrays are slow in general, and having them in this immutable fashion required multiple rewrites of the board while making a move. So an array is slow, and the Beginning Chess Engine has 8 arrays arrayed in one for the board. This is slow x 8, inside of a slow array. So, I ditched that and started with one array of characters.
Char (character arrays) can be edited on the fly, without rewriting the whole array again. As of this writing, the JustChessEngine outperforms the Beginning Chess Engine in speed tests at various ply by three to one! That’s a big gain! Be sure to check it out and feel free to leave comments.
Linux – keep it simple.
2 Replies to “Fool’s Mate Friday: The JustChessEngine”
Are you changing your approach to ply management, or do you still have a fixed ply with no concurrency?
So far, I think I’ll stick to the alpha beta method, but I’m hoping to switch to some other method as I learn new ways to handle it.