Skip to content

Instantly share code, notes, and snippets.

@wouterdb
Created June 19, 2019 07:39
Show Gist options
  • Save wouterdb/9007af4dadc707af05ffcd78a9afe31b to your computer and use it in GitHub Desktop.
Save wouterdb/9007af4dadc707af05ffcd78a9afe31b to your computer and use it in GitHub Desktop.
Checkers question
Make a program to calculate all valid checkers moves for a specific piece, given the position of all pieces on the board.
rules
1- always move diagonally forward 1 square (either left or right)
1- pieces capture diagonally by jumping over a piece that is diagonally adjacent
1- captures can capture both forward an backward
1- if at the end postion of a capture you can do another capture you must also make this capture (chaining)
1- if a capture is possible, only the longest capture chain is a valid move
(actual assingment had better explanation)
(it demonstrates some style aspects, representation of the board, some simple logic (everything except chaining) and a more complex algorithm (longest chain)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment