How to configure Move Generator Scope

As I said before, I used Sharper as a benchmark for correctness of my move generator, It is a great engine and supports all the requirement needed to do a comparison between generation of two engines. So the default configuration works for Sharper. The shortest path to test your move generator is to made it compatible with sharper for the needed commands, and use the default configuration. If you prefer using another syntax for your commands, or test with another generator, you possibly need to change something, and this page should explayn how to do it. If not, please feel free to open an issue on the project, or contact me directly.

This is the configuration form screenshot:


First the obvious: the working folder is the path in which the engine resides. In some cases could be not necessary at all, but if needed here is the place to specify.

Then we have two main topic to configure:
  • The Templates part, is about how to format commands to the engine
Here we use the Antlr StringTemplate library internally. This library is very useful for emitting strings based on a template. We do a very poor use here, but if you need more help about how to use it, please refer to the link. We have to keep in mind that for each of the following templates the "Return" is not implicit, so if we want to send a new line to the engine, we have to specify $\n$ in our template.
  • Init: Should the engine needs some startup command to be able to perform test, here we can place the string(s) needed.
  • Set Initial Position: the template for setting the initial position. for Sharper is new$\n$: it mean a literal new following by new line.
  • Force: enter force mode command ( ie do moves if valid, without calculating ). The template for Sharper is given in the screenshot, the description is same as above.
  • Get fen: obtain the Fen for the current board. The template for Sharper is given in the screenshot, the description is same as above.
  • Set Board: a template for setting the position based on a fen string. Here we have setboard $fen$$\n$. This mean: the literal setboard, followed by a space followed by the variable fen followed by new line. So you can pack the setboard command as needed using the variable $fen$ in your template.
  • Divide: The template for executing a divide command at a certain depth. The variable available for the template is $depth$
  • Move: the template for executing a move. The $move$ variable contains a move in the form "a2a3".
  • The Extractor regular expressions part, is about extracting needed information from the engine output
This could be a little tricky, .Net Regular Expressions are used to parse the line and extracting the substring needed in a single capture group.
  • Moves Count: This is for extracting the moves count produced by each line dumped by the divide command.
  • Move: This extract the move string from each divide output line ( both this and previous regex works with Sharper, and expect a divide results line in the form a2a3(space)NumberofMoves
  • Divide End: A regex that, when matched, mean that the engine finished with the divide command. For Sharper we expect Moves:(space)The number of moves
  • Fen: A pattern for extracting the fen. For sharper is very simple, just because it emit immediatly the fen without any other things: the pattern (.*) means capture all characters.
  • Fen End: Should the engine write some lines after emitting the fen, this regex must match the last one, to understand the engine finished with the command. It is not needed for Sharper.

Last edited Nov 1, 2008 at 10:24 PM by felixpollan, version 10


No comments yet.