Fool’s Mate Friday: the Just Chess Engine is just getting started…..

There are only 20 first moves in any standard game of chess. 20 choices, 20 options. Statistically, only 10 of those options regularly result in a win, or at worse, a draw among experienced players. 10 of those moves statistically result in a draw or loss. So, choosing that first move is actually one of the most important things you can do in the game of chess. If we extrapolate that, I’m sure there are a lot of tie ins to life itself.

Likewise, when starting to create a chess engine the opening moves are going to set the stage for the remainder of your work. Here’s how I am getting started:

Back to the basics, getting started on the Just Chess Engine. I decided to save my work sequentially to GitHub as I meander through this process to make it easy to follow. This also has bailed me out numerous times when I royally messed up my code, and I simply reverted back with my commits.

The first commit was just making a blank app in Android Studio. In the second commit, I added the board, logically. By logically, I mean what the engine holds as the board. This can differ than what is displayed physically to the user. Depending on the set up of the Android app, whomever is using this engine may also retain their own copy of the board, and simply feed data into the engine.

One might wonder why we would do that, but this could be quite handy. For instance, if I enable the Universal Chess Interface, the app creator may use a Beginning Chess Engine style of board for player interface, or a bitmap board, or whatever style they choose, and just ask the engine for a move suggestion from the computer. So, you need a way to ask the engine what it thinks, and then the engine needs it’s very own board to work with. So, keeping the logical board separate from the physical board is (to me) a good idea.

Finally, the third commit is adding a way to call for a move. At this point, the move call is empty. It doesn’t actually return anything, but sets the stage for when we start populating move options. Here, we call for the engine to tell us “all available moves”. The engine then searches through the 64 squares of the board, and for each character that matches a given symbol (k for king, r for rook, etc.) it will call a method() to check for that pieces available moves.

So far, our engine really doesn’t do much, but we are really just laying the foundation to build the engine from the ground up.

Linux – keep it simple.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s