Well, in a fit of productivity (or what passes for productivity when you are working on useless pet projects), I decided to get the Chinook 6 piece endgame database working in my checkers program. How hard could it be? They give you code to access it after all. A few simple adaptations, and….
Well, it’s not that simple. The code is dreadful. I mean really bad. First of all, it’s not even ANSI C. I haven’t seen K&R style declarations in a maybe fifteen years, and haven’t written any non-ANSI C in twenty. But
protoize does a pretty good job of fixing that up. There are a slew of warnings, but those aren’t really difficult, you just tidy up the code a bit, and it’s clean.
Of course, it still doesn’t work. That’s because (sorrow of sorrows) they wrote the code in a very unportable way. This drives me crazy. They use the “long” datatype all over the place, but as written, I am pretty sure that the code will fail horribly if long is 64 bits. Which, of course, every machine I play with these days are. And there are a few “signed/non-signed” issues, and the fact that lseek doesn’t return a long anymore to confound you a bit. And, of course, the interface routines are all written to accept board positions in a format which only the Chinook guys could love, and it took me way too long to create an adapter to make it work.
But I think it does. At least, it seems to pass some preliminary tests:
milhouse, a checkers program by Mark VandeWettering. transposition table enabled, 4194304 entries, 96 Mb used quiescence extension enabled 165 puzzles in the puzzle library sanity checking sizeof(long) = 8 initializing Chinook endgame database... ... creating table ... using database DB6 ... allocating 48132029/47004 entry index ... initializing 2...3...4...5...6... database ... allocating 16384 buffers ... initializing 16384 buffers milhouse: puzzle 164 LOADED puzzle 164: First Position, white should win, but it takes 92 moves.. Color is set to white. White +--------+ | - - - -| |- - - R | | - - - -| |- - - - | | - - - -| |- w - - | | - - w -| |- r - - | +--------+ Red milhouse: db Chinook sees this as a win for white milhouse:
This is the classic First Position, which it sees as a win for white. Unfortunately, it doesn’t actually play the ending very well. It won’t lose it as white (ever), but because of search horizon issues, it won’t find the winning line either (it’s 92 moves long, so that’s not suprising, but still).