Kiwi
Copyright (c) 1999-2004,2005 by Alessandro Scotti.
http://www.ascotti.org/
Kiwi is a Winboard/XBoard chess engine.
Version 0.6d
November 18, 2005. Hopefully fixed some problems with mate scores, which were introduced by removing the "safety net" in version 0.6c. Better tuning of history pruning parameters. After a suggestion from Guenther Simon I took a profiler and found the code was being slowed down by several problems: 1) hashing of pawn evaluation was commented out, probably after a debug session; 2) evaluation is called at all nodes and was taking a lot of time, now added a fixed 2 Mb eval cache; 3) got fed up of maintaining the assembly code on Linux and Windows, throw everything away and replaced it with some really smart stuff by Gerd Isenberg. Thanks to these changes, Kiwi's NPS rate has noticeably increased (got an extra 22-23% on average).
Version 0.6c
November 4, 2005. Removed "virtual depth" code and mate distance pruning (could never work in that way with MTD). Hash table not cleared after a mate score is found, it was not easy to pull this long-standing "safety net" but the engine seems to work equally well without. Probing code for KBPK bitbase fixed. Time allocation code is changed now, it should avoid many time losses. Thanks a lot to Guenther and Ciro for pointing those bugs out! :-)
Version 0.6b
September 23, 2005. More and more (huge) holes filled... Kiwi could even play invalid moves in some positions! Anyway, bug fixing was good for playing strength and that allowed me to dare adding a couple of new features. Passed pawn evaluation has more knowledge. Piece/square tables were too "shy" and are now pumped up a little. History pruning back in. Note: opening books for this version must be re-created or downloaded again, old books won't work.
Version 0.6a
July 12, 2005. Evaluation has been completely rewritten and has more chess knowledge (not difficult, compared to what it had before). More preconditions for null move and futility. Fixed a couple of serious bugs in root move ordering and quiesce. History pruning removed from beta.
Version 0.5c/0.5d
June 28, 2005. Fixed two bugs that caused time losses in some situations. Null move is now allowed to go directly into quiesce (with checks). Version 0.5c was released as beta to better test these changes. Version 0.5d adds 4-way hashing and hashes more positions than used to, something that didn't work out in older versions but seems to help now.
Version 0.5b
May 19, 2005. Fixed a bug in the book handling that caused terrible errors in the opening (note: old books are not compatible so you must recreate or download them again) . Changed some evaluation parameters.
Version 0.5a
Mar 08, 2005. A few tweaks on the search and another bug fixed (thanks a lot to all the people in the Winboard forum for the help and support they gave me). The most important feature is interior node recognizers, which for now are limited to KPK, KBBK and KNNK (all manually coded, no tables). They can't make a difference yet, but endgame play should improve as new recognizers are added in future releases. (Besides, coding them is a refreshing experience compared to debugging search code...)
Version 0.4d
Feb 08, 2005. Very little changes from version 0.4c, mainly on extensions and move ordering at the root (I am always experimenting on this and I hope I've got it right this time, it's more a matter of principles than else...). There is an important bug fix though, as under Linux the engine was "stealing" some CPU time from the opponent.
Version 0.4c
Jan 30, 2005. Most of the search and move ordering code has been rewritten to make things simpler. SEE is back in, used for ordering and pruning. Several bugs have been fixed, including those slipped in version 0.4a... All in all this version should be stronger than 0.4b, but most important it will make future work much easier.
Version 0.4b
Jan 16, 2005. Ops! A major bug (...ok, make that a couple...) slipped in previous version so a lot of code in this version had to be recovered from version 0.3c... my fault for not testing the new code carefully enough! :-( Now there will be no more extra features for a while, as current code needs some cleaning and polishing first...
Version 0.4a
Jan 09, 2005. Finally added a SEE, which is currently used to prune quiesce captures. Tentative implementation of a history-based pruning. Book loading is about 4x faster, thanks to improved parsing of SAN moves. Some tweaks and bug fixes.
Version 0.3c
Nov 29, 2004. Many bug fixes in the evaluation code. Some changes in move ordering, pruning, extensions and quiesce search should make the engine more aware of tactical shots. Of course pumping up search parameters is not without risks in itself, so we'll have to wait some games to see if it really works in practice...
Version 0.3b
Nov 17, 2004. After a long struggle, I've had to wave goodbye to my beloved multithreaded input code: it's just too unreliable under Windows. The system library now detects when standard input is a pipe (i.e. engine is being run under Winboard, Arena or so) and if so uses polling. Other platforms and input types (e.g. console) keep using the "old" approach. I've also fixed two nasty bugs in the pondering code... very difficult to find! Many thanks to Günther Simon (RWBC tournament) and Leo Dijksman (WBEC-Ridderkerk tournament) for sending the bug info and helping me testing the fix! :-)
Version 0.3a
Nov 12, 2004. Some engine parameters can be specified in a configuration file (see instructions inside "kiwi.ini")... more configurable parameters to come! Fixed a bug in en-passant handling, which unfortunately makes old books incompatible. Evaluation stuff has been completely rewritten. This doesn't necessarily mean that Kiwi plays better right now, because 1) it still lacks a lot of knowledge; 2) it runs slower; 3) there are literally hundreds of parameters that must be tuned and that could take a long time! In the long run, however, the new design should make for better chess.
Version 0.2b
Oct 8, 2004. Linux binaries. Book manager now trims some unwanted transpositions. After the sequence 1. e3 e4 2. e5 Nf6 3. Nf3 Kiwi would play Ng8?? out of book! Suite command works properly.
Version 0.2a
Oct 6, 2004. Fixed a bug in time control handling where the engine would not consider the moves played manually. Some minor fixes. Added opening book (simple stuff really, but it works).
How to create an opening book. Run the engine in console mode and type "help": a short help screen should appear. You can use the "bookadd" command to add positions to an internal book (different from that used to play), it takes three parameters: the name of the file containing the games in PGN format, the minimum number of moves for a game to be considered, and how many plies (half moves) have to be copied in the book. So for example:
bookadd gm2600.pgn 30 20
loads games that last at least 30 moves from file "gm2600.pgn", and copies the first 20 plies (10 full moves) into the book. Note that subsequent "bookadd" commands will add positions to the internal book, so it can only grow in size. The only way to reset it is to exit from the program.
Note: during book creation, the entire internal book is kept in RAM so there is probably a limit to the number of games it is possible to load. I've only tested it with about 70000 games (a few million positions) so do not exaggerate!
After the internal book has been populated, you can save it with the "booksave" command, for example:
booksave book4.dat 4
will create an opening book named "book4.dat" that contains all positions that were played at least 4 times. It is possible to save as many books as wished without having to reload the games in between.
At startup Kiwi automatically loads a book named "kiwi.obk" (if found). In console mode, you can load any other book with the "bookload" command followed by the book filename.
How to run a test suite. In console mode, run the "suite" command specifying the name of an EPD file containing test positions and how many seconds per move to think. At present only "bm" (best move) tags are supported (i.e. no "avoid" moves). For example:
suite wacnew.epd 5
All results are put in the log file "kiwi_log.txt".
How to run perft. In console mode, simply issue the command "perft" followed by the desired depth. The test is run from the current position, which can be changed by "setboard" followed by a valid FEN string.
Tip: filenames containing spaces may be quoted.
Tip: it's possible to see what the book suggests using Winboard. Click on Help -> Book. In console mode, this corresponds to the command "bk". Note that all suggestions come from the last loaded book, the internal book is used only for creating other books and never for playing.
Tip: Winboard commands are always valid. So, type "quit" to exit from the program.
Version 0.1c
Sep 30, 2004. Just a bug fix for Win95/98 users: program would freeze at startup.
Version 0.1b
Sep 19, 2004. First public release. Supports most of the Winboard protocol. No opening book yet. No configuration file. Logging always enabled, will log info on "kiwi_log.txt": this file is overwritten every time the engine starts.
History
Development on the Kiwi engine began in December 1999 but stopped almost completely in January 2000. At the time I was also working on a GUI written in Delphi, which I also had to abandon for reasons that I can't remember now (though, statistically speaking, "too much work at real job" shouldn't be too far from truth). Last August (2004) I was stuck for technical reasons on my latest project Tickle and decided to wipe some dust from good ol' Kiwi. The newest build I could find in my disk was from March 2000, which contained at least a few fixes with respect to the January build, which was really buggy.
Most of the work I did during August and September 2004 was fixing the bugs left (sometimes with help from the great folks at CCC) and implementing the Winboard protocol. In fact, the engine is lacking some serious work in important areas (e.g. how positions are evaluated), but for now playing weak chess is a great improvement with respect to playing illegal chess! :-)
Technical data
Kiwi's development was heavily influenced by Prof. Hyatt's engine Crafty (I think it was version 9.x at the time!), so I'm also using bitboards, rotated bitboards and similar code for move generation and move ordering. However, Kiwi is written in C++ and the design and implementation is quite different from Crafty's. Besides, there are several things I want to do differently now, but they'll have to wait for some future release.
For searching, I'm using the MTD(f) algorithm as described by Aske Plaat, and I've had my share of trouble getting it to work reliably enough. The rest is pretty much standard stuff: futility pruning, null-move (R=1), check and pawn push extensions, 2-slot per entry hash table. I have a long "todo" list though, and many things are definitely going to change...
WAC (new) results: 285/300 on 700 MHz Athlon at 5 seconds per move, 297/300 on 1.8 GHz P4 at 30 seconds per move. Kiwi nemesis: WAC 180.
System requirements
For Windows: any 32-bit version of Windows, running on a Athlon or Pentium 3 CPU or better. Couldn't test it on many platforms though. Engine requires about 3 Mb of free RAM plus the space allocated for hash tables (configurable from version 3.0a).
For Linux: same as Windows, but running Linux! :-)
License
Kiwi is Copyright (c) 1999-2004,2005 by Alessandro Scotti.
This program is distributed "as-is" in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. In no event will the author be held liable for any damage arising from the use of this software.