Search code examples
language-agnosticchess

Chess move validation in larger than 8x8 board?


I am creating a chess variant. The rules and pieces are the same with classic chess. The only different is the size of the board (12x12 instead of 8x8).

My goal is to validate and apply moves only. What options I have aside from writing everything from scratch?

Most popular formats seem to be limited to 8x8 boards only.

I am fine with any popular programming language.


Solution

  • There are three general approaches chess engines take in move generation. In chess programming jargon these are commonly known as:

    1)Bitboards

    2)Mailbox (chess jargon for arrays with padding)

    3)Piece lists

    The most common method used today is Bitboards, which unfortunately is not easily modifiable to larger boards. This shouldn't be too bad for you, however. The reason bitboards are the de-facto standard is not because the are the easiest to implement (they are in fact the most complex), but because they are much faster for move generation (and by extension validation). However, this is only pertinent for use in a search function that needs to validate moves tens of millions of times per second. If you just want good old simple move validation, the method two should be more than adequate, and easily adaptable to larger boards. If you want to see chess engines that utilize this method, look up engiines that use a mailbox or oX88 board representation. I think the didactic CPW engine uses mailbox.

    https://chessprogramming.wikispaces.com/CPW-Engine

    and here is an article about move generation: https://chessprogramming.wikispaces.com/Move+Generation