ROCE-Roman’s Own Chess Engine

Readme (10.09.2005)

Intro

Roce is yet another chess engine that probably no one needs. Still it's a lot of fun to work on it. I started writing Roce around christmas time in 2003. At first it was supposed to be a weeks or months project mainly meant to improve my knowledge of the C programming language. But the project turned out to be much more challenging and timeconsuming than I ever thought it would be.

How to run Roce

If you intend to play against Roce you should get a nice GUI like Arena or something else that supports the UCI protocol. Roce should also work under the Fritz 8 or under the Shredder classic Interface.

Playing strength

Roce is definetely one of the weakest engines currently under developement. It won't miss a mate in two but it hardly gets into a position to mate anyone, of course. On the other hand it plays a very attacking style which might be interesting for a beginner. This style is also the main reason that Roce is doing so terribly bad when playing other engines as the queen often gets lost early in the game in an unsound attack. I estimate that Roce 0.034 has currently a rating of about 1300 but I'm pretty sure that I'm able to to improve the program quite a bit as there is a lot of stuff either still missing or badly implemented.

History

  • x-mas 2003, start to write a move generator
  • february 2004, HD failure on my notebook, sources are lost
  • march 2004, start coding again
  • august 2004, move generator works fine up to ply 5
  • septembre 2004, fixed an ep-bug, move generator seems to work fine now
  • decembre 2004, implemented minimax/negamax and a simple material eval
  • january 2005, implemented a NegaMax search
  • february 2005, added a pieces/square table in order to improve move ordering for alpha beta
  • june 2005, replaced the material-only eval with a material/square-evaluation
  • june/july 2005, added parts of the UCI protocol to the engine
  • july 2005, Roce 0.034 played the first games against other engines (and lost most of them)
  • july/august 2005, fixed several bugs (promotion bugs, input/output problems) new version 0.0344
  • A few technical details

    Roce is based on the rather old fashioned 10x12 board representation which was already proposed by Shannon. To the 8x8 board are two additional rows added at the bottom and at the top and to each side is one additional column added. That results in a 10x12 sized board which is represented as int board[120] internally on the computer. The 10x12 board representation has the advantage that illegal moves are easy to handle. So the knights don't 'jump off the board' (i.e. no need to check for array over- or underruns). The square A1 is represented by board[91] and the square H8 is adressed with board[28]. The pieces are represented by integer values {K=6, Q=5, R=4, B=3, N=2, P=1, k=-6, q=-5, r=-4, b=-3, n=-2, p=-1}. If the white knight jumps from B1 to C3 this is performed as 'board[b1+offset_knight] = white_knight' which is translated by the compiler/preprocessor to 'board[73] = 2'. Valid offsets for the knight on the 10x12 board representation are: 21, 8, 12, 19, -21, -8, -12, -19. The white pieces can only move to a target square if this square is either empty or if an opposite colored piece is on this square. Empty squares are marked with the integer value 0 (board[C1] = 0).

    Roce uses a legal-move generator instead of a pseudo-legal generator which means that only legal moves are generated. In general legal-only-move generators are considered to be a tad slower than pseudo-legal move generators but when I simplified my move generator to generate pseudo-legal moves I didn't got much of a speedup, so I changed that back. Currently Roce isn't doing much beside generating all the legal moves from a certain position. There is a search (Negamax with alpha beta cutoffs) and a simple incrementally working evaluation function in makemove which evaluates only material and squares implemented and it doesn't work very well yet. One of the problems with the search is to store the main line in a reasonable way and to have the moves which are generated by the move generator sorted in an order that alpha beta produces some cut offs. Seems that's a bit more tricky than I thought it would be. There is a very simple move ordering sheme based on squares and material gain present in Roce. Roce doesn't search very deep due the bad move ordering mainly and has only some very basic extensions. That means Roce isn't aware of the danger of several checks as an example.

    If you are writing you're own move generator or chess engine you might be especially interested in the commands divide, divide2. 'divide #' gives the number of child moves at a certain depth while 'divide2 #' gives the total sum of child moves to this depth. 'perft #' gives the sum of legal moves at a certain depth while 'perft2 #' sums them up. This is a usefull feature if your movegenerator comes up with different numbers and you need to track down the bug. Currently Roce supports the UCI protocol and some parts of the Winboard protocol as well but I'm planning to implement both UCI and Winboard in full generality.

    What is RoceConfig.exe good for?

    Most chess engines give you the option to change some settings of the engine. This isn't different with Roce. Most of the changes to chess engines are done with the help of configuration files. But editing config fils with an editor can be a bit tricky. Often the ordering of the options in the configuration file is important and the engine might not be able to parse the file properly if there are spaces where they are not expected and there is also always the danger of spelling errors, of course. Thanks to the effort of Patrick Jansen Roce (versions beginning from 0.0344) comes together with a nice configuration tool which overcomes all this shortcomings. RoceConfig helps you to adjust the settings of Roce to your needs without having to fiddle around with the configuration file directly. RoceConfig does that all for you and stores the changes in the file Roce.cfg which is read by Roce at startup. So you have only to make sure that RoceConfig is stored in the same directory as the engine.

    What is the file perfttestsuite.epd good for?

    The file consists of a testsuite of positions which are usefull to check if the movegenerator works properly. This feature is mainly used to check if the engine is still working properly after some modifications have been made to the sources. The test can be started by entering the command 'testmovegen' and takes -depending on the speed of your computer- a few minutes to hours to finnish. It's sufficient to run this command only once on a certain computer to make sure it's working properly as some aggressive optimization might cause problems on some processors. Don't edit the content of the file if you're not sure what you're doing. Most of the positions in the file were posted by Andrew Wagner on the Chess Computer Club (CCC) in 2004.

    Credits

    The chess engine Roce is written entirely by me. The name is program. But of course, I was able to recycle a lot of great ideas from some smart people (standing on the shoulders of giants). The main reason I got interested in the chess programming topic was because of an article that appeared in the German Computer Journal DOS in 1997. The article 'Der PC lernt Schach-Das Spiel der Koenige' was written by Chrilly Donninger and Klaus Manhart. Later when I was writing on my engine I also learnt a lot about the matter from Bruce Morelands excellent site. Numerous ideas I got by reading and asking questions on several chess forums like the Winboard forum or the Chess Computer Club.

    Roman Hartmann
    rhartmann@bluewin.ch