Morabaraba Opening Book
Submitted by Adam Oellermann on Thu, 2007-12-06 05:22. C | Morabaraba | Opening Book | SQLiteIt's been another long hiatus since the last release of my Morabaraba program, but at last there's a new version in the pipeline.
First, some politics: the last release (0.8) was made purely in response to some silliness on behalf of the people at Mind Sports South Africa (MSSA). If you've been following, you'll know that the MSSA folk asked me if I could use their move notation in my program. I readily agreed, and did the work to convert (released with 0.4 on 2007-03-11). As a result, I've used that standard for a wide range of purposes, including the forthcoming Free Internet Morabaraba Server, a Morabaraba diagramming web site and others. I also thought it would be good to document this format on the Morabaraba Wikipedia article, which I did. This led to me getting a "nastygram" from the MSSA president and a lawyer, accusing me of theft, deception and all sorts of things. I was, needless to say, tremendously pissed off, and the 0.8 release did nothing more than remove the MSSA notation. I have since removed MSSA notation from all of my Morabaraba bits, and from the Wikipedia article. Note to MSSA: you were getting free publicity for your standard (both at www.morabaraba.com and Wikipedia, you were acknowledged as the creators with links and all the rest of it; now, a competing standard is being promulgated very publicly and you aren't getting free exposure at www.morabaraba.com. For future reference, you want the barrel of the gun pointing away from your foot when you pull the trigger!
Anyway, that little episode left a sour taste in the mouth, so it's taken me a while to get enthused about Morabaraba again. However, I have had some feedback from former World Champion Simphiwe Maphumulo, which confirms a couple of my suspicions: the program doesn't play too well in the openings, and it needs to play a lot faster (especially in the openings) to be taken seriously. Well, these points lead to one inescapable conclusion: AHEM desparately needs an opening library. Now, this has been on the "todo" list since the beginning, but I've never quite gotten around to it - partly because its a big chunk of work to tackle, and partly because I've never written an opening book before. However, it looks like an opening book will provide the best "return on investment" for my programming time, so I'm getting started.
The Approach
As far as I can tell there is no documented opening theory for Morabaraba. There is also no library of published play. Taken together, this means that there is no real source of openings expertise to tap. Accordingly, my opening library will be computer-generated. The approach that I'm taking is based on Thomas Lincke's drop-out expansion algorithm, which will hopefully provide "good enough" coverage for less common lines, and really deep coverage for key lines. Martin Fierz (http://www.fierz.ch/strategy4.htm) has used this approach with great success in his Cake draughts/checkers engine; I see no reason why it shouldn't work well for Morabaraba too.
All the logic required to deal with the opening library (both creating it and using it) will be in the engine. This means that any front-end will benefit without modification; also, creating a new book will be as simple as running the command-line app. Of course, I will be building a large book by leaving the command-line app running for a very long period of time; hopefully this will result in a very solid book developing over time.
The Database
I decided not to write the storage and query engine myself. I really don't want to be burning time on that, even though it would probably end up being quite a lot more efficient. Instead, I'm just hooking SQLite in. This has a number of advantages - it gets me going quickly, it's really easy to work with from C, the database library can be compiled right into the AHEM binary, and it allows me to run complex queries against the data very easily (just by using SQL). As a side-effect, it's also easily portable - there are SQLite bindings for loads of languages on loads of operating systems.
I haven't worked with SQLite before, so I was expecting a bit of a learning curve - but I must say, it's really quite straightforward. Kudos to the SQLite team for an excellent product (in the public domain!) which not only functions very well, but is also a pleasure to work with.
The Timetable
No commitments, you understand, but I hope to have this mostly done by the end of the year (that's 2007). I aim to release version 0.9 then, with a small opening library, and work on computing a big opening library in the background.