Skip to content

Instantly share code, notes, and snippets.

@peat-psuwit
Created May 13, 2017 15:11
Show Gist options
  • Save peat-psuwit/68df8938ea8da4dc0fee2cba9b905991 to your computer and use it in GitHub Desktop.
Save peat-psuwit/68df8938ea8da4dc0fee2cba9b905991 to your computer and use it in GitHub Desktop.
Robot can walk 3/5 units at a time. Can it walk N units?
checkWays(0).
checkWays(N) :-
N >= 5,
M is N - 5,
checkWays(M).
checkWays(N) :-
N >= 3,
M is N - 3,
checkWays(M).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment