Bug Fix Release of Maverick (Version 0.51)

Maverick 0.5 has been in the wild for about a month. I’m pleased to say it seems to be playing at 2300 ELO or above.

However, occasionally it would crash. This really niggled me.

I do quite a lot of turbo-testing using CuteChess-Cli at fast time controls.  So I had convinced myself the occasional crash was probably an overload of the standard input and output pipes (I’m not even sure if this is possible). However, since I’ve tested Maverick quite thoroughly using perft positions, I was confident the basic chess engine routines were bug free. I was wrong.

This week I have been down in São Paulo Brazil on business. Graham Banks has been testing Maverick and broadcasting the games.  Since I had nothing better to do I logged in and watched a few games.  It’s amazing how nerve wracking it is to watch your engine play a game at 40 moves in 40 minutes. As I was watching, and to my surprise, Maverick suddenly crashed. I quickly copied the position and thankfully was able to reproduce the crash!

The bug was quite bizarre. Take a look at the position below:

discovered-check-bug

After black has played pawn to g4, white is in check from the queen on h6. However, the code which finds the source of the check is shown below:

discovered-check-bug-codeThis was a “copy and paste” error. The code thinks the knight on c2 is actually a king attacking the white king. This was the bug.  It was easy to fix.  Hopefully this will result in no more crashed.

You can downloaded the fixed version (Maverick 0.51) on the Download Page. There are really no strength improvements for this bug-fix release.  If you are testing Maverick you can keep the games already played.

Bugs Bugs Bugs!

The chess engine Fruit has many strengths; one of the main ones I believe is simply the lack of bugs. Fruit’s author Fabian Letouzey has a defensive coding style.  He litters his code with “assert” statements.  When he was actively developing Fruit he set out a challenge – he said if you find a bug in Fruit he’ll fix a bug in your code (can’t find link).  I think this highlights his emphasis on finding and fixing bugs.  This philosophy has certainly influenced my coding style.

So now Maverick 0.2 is out I’ve spent most of my chess development time finding and fixing bugs.  There is a great temptation to add knowledge, feature and improve the search. But a couple of times I’ve sat down and just focused on finding bugs. On some occasions I have a specific bug or odd behavior I have identified and which I’d like to fix.  But often I’m just hunting for bugs.  I might set myself the goal of finding ten (small) bugs in two hours.  I then go through Maverick’s code with a fine toothpick, forcing myself to challenge the logic of every line and asking myself what I’m assuming at each stage.  It’s amazing what you discover.  If you have a chess engine give it a try.  Set aside some time to focus on simply finding bugs.

Let me know how you get on!