Skip to content

Instantly share code, notes, and snippets.

@mmlac
Last active January 27, 2022 02:40
Show Gist options
  • Save mmlac/00cd35e0306d95141ab5d00a61a018c3 to your computer and use it in GitHub Desktop.
Save mmlac/00cd35e0306d95141ab5d00a61a018c3 to your computer and use it in GitHub Desktop.
03
Given a chess board of dimensions X by Y and a starting position of A and B,
output the first P sequences of moves of a Knight piece that cover every field
and return to the starting position.
A Knight piece can only move in an L-like motion, going two fields in one
direction and then one field 90 degrees to that, or one field in one
direction and then two fields 90 degrees to that.
Create a function that takes five integers X, Y, A, B, P as inputs.
Print out a human-readable representation of a completed sequence,
as soon as one has been found, to the console until P have been found
or the solution space is exhausted.
Use all cores available on a machine. Do not use "parallel" data structures
or libraries that contain those, i.e. data structures that have functions
built in to do parallel traversal.
Describe the tradeoffs between a single-core solution and a multi-core solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment