Chess player/Move generation: Difference between revisions

From Rosetta Code
Content added Content deleted
mNo edit summary
No edit summary
Line 1: Line 1:
{{draft task|Move generation}} This is a sub-task of the Chess player task.
<strike><nowiki>{{draft task|Move generation}}</nowiki></strike> This is a sub-task of the Chess player task.


Using suitable data structures, generate a list of valid moves given a chess game position and the side-to-move. You can create a basic (and incomplete) solution or create an advanced solution which covers all possible moves and depends on tracking more of the game state.
Using suitable data structures, generate a list of valid moves given a chess game position and the side-to-move. You can create a basic (and incomplete) solution or create an advanced solution which covers all possible moves and depends on tracking more of the game state.

Revision as of 23:20, 27 February 2020

{{draft task|Move generation}} This is a sub-task of the Chess player task.

Using suitable data structures, generate a list of valid moves given a chess game position and the side-to-move. You can create a basic (and incomplete) solution or create an advanced solution which covers all possible moves and depends on tracking more of the game state.

Basic implementation:

  1. Moves based on piece type
  2. Promotion to queen
  3. Allow resignation

More advanced/full implementation:

  1. Castling (not through check)
  2. En-passant capture
  3. All promotions
  4. Move legality for moving in/out of check
  5. Draw by repetition and 50-move rule

Describe how complete your solution is, and try to create a self-contained component which could be used by a complete chess program.