Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let advance dist loc =
match loc.dir with
| North ->
let npt = { x = loc.pt.x; y = loc.pt.y + dist }
{ loc with pt = npt }
| South ->
let npt = { x = loc.pt.x; y = loc.pt.y - dist }
{ loc with pt = npt }
| West ->
let npt = { x = loc.pt.x - dist; y = loc.pt.y }
{ loc with pt = npt }
| East ->
let npt = { x = loc.pt.x + dist; y = loc.pt.y }
{ loc with pt = npt }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.