Created
February 17, 2017 17:38
-
-
Save zakaluka/373ae5faffd058077246ec48091fb38c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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