They say that the first complete chess playing program was written by Alex Bernstein in 1957. There were earlier renditions that could not play a complete game, but could solve tactics puzzles or make move suggestions, however, the Bernstein Chess Program was the first computer program that could actually completely evaluate and play a game of chess. For grins, I looked it up, and it was played on an IBM 704 computer, which was an entire room. It took about 8 minutes to make each move, before printing out the board on a piece of paper. You can check out a video of him playing the machine on YouTube.
My JustChess game is not so glamorous, but it is getting more interesting with each passing reiteration as I work on it’s programming. Last week, I talked about how you can now actually play against the phone/computer or against a person in pass and play mode. There were several bugs that still needed to be ironed out. In particular, making a move by the computer sometimes erroneously rearranged pieces on the board.
I found a quick and dirty work around for that. What I changed in this latest commit was that of how moves are made. What appears to be happening, as the ply goes up, the phone runs into a problem where the threads of various potential board positions are getting moved or mixed up. Probably due to poor code on my part. Either way, it then makes moves on boards that were not the actual play board, but that were hypothetical boards and pieces moved during it’s multi-ply search. I think.
So, to avoid this problem, I have changed the order of things, and added a step to copy down the board as it is, before a move is calculated, and then use that copy of the board to make the move with. Here’s a breakdown:
- Write down a copy of the board, as it is.
- Calculate the multi-ply best move with the original board.
- Write down the best move.
- Re-write the original board with the backed up copy, just in case it got messed up.
- Make the best move that it wrote down.
This seemed to work pretty well, most of the time. It completely fixed the issue of messed up or mixed up board pieces. However, it now has another new problem, where it can occasionally get “stuck”, and the program will hang until it is closed by Android. This seems to happen randomly, and doesn’t happen every game. So, more work to be done for sure.
I’ve also been “tuning” the JustChessEngine as well. But that’s another post….
Linux – keep it simple.