Given a board setup up with initial knight position and destination, it finds the shortest path (minimum number of steps) for the knight to another position (destination) on the board.
$ bundle install
$ rails s
* All responses from the app are JSON encoded
url: <app_url>/chess_boards
method: POST
params: { knight_position: 'H1'}
You will get board_id
as response. With that board_id
call,
url: <app_url>/knights/get_shortest_path
method: GET
params: { board_id: '<board_id>', destination: 'G2' }
The response will contain the shortest_path
.
$ rpsec