Check out Janggi (Korean Chess), our featured variant for November, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

Florea Aurelian asking questions about chess programming[Subject Thread] [Add Response]
H. G. Muller wrote on Sun, Oct 9, 2016 08:36 AM UTC:

The best place to discuss about Chessprogramming is the programming section of the TalkChess forum. I posted a tutorial for interfacing engines with WinBoard on WinBoard Forum.

If your main interest is in large variants, it is probably best to use a mailbox representation of the board. Mij preferred way for generating moves is to associate a 0-terminated list of board steps with each piece,one for every direction it moves in. A move generator can then for each piece loop over these directions, and for each direction loop over distances if teh piece is a slider.

Fairy-Max it also keeps a secondary step and primary and secondary 'move rights' for each such direction, to allow for bent moves like those of the Griffon or Xiangqi Horse. This limitation to two legs is not completely general, however. For the diagram I therefore expanded this system to a sort of interpretable intermediate code, where each direction can consist of an arbitrary number of (boardStep, range, rightsFlag) triple,which each in addition list how many legs of the move in this direction still follow (so they can be skipped if the move fails to meet the reqirements indicated by the rightsFlag in an earlier leg, e.g. if the XQ Horse finds its first square blocked). So there really is a 0-terminated list of (boardStep, range, rightsFlag, remainingLegs) quadruples, where each direction first loops over legs (until it finds remainingLegs = 0), and each leg then loops over distance if the range fieldfor it specifies so.

In the diagram script I compile the Betza move descriptors to such lists, writing a separate description for each allowed direction (or combination of directions, if it is a multi-leg move) of an atom. E.g. the XQ Horse, afsW, would get 8 moves each consisting of two legs, because the first leg allows all four W steps, and the second step doubles the number of paths by allowing two different continuations through the s = l + r specification. For each of the 16 legs the step direction is then unique, and the step can be obtained by rotating the basic atom step in that direction.