Created
December 18, 2016 18:36
-
-
Save theburningmonk/a8a337a228ed9614e16a05f58fe2a216 to your computer and use it in GitHub Desktop.
Advent of Code (Day 17)
This file contains hidden or 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 inline between low hi x = x >= 0 && x < hi | |
let step direction (dx, dy) (x, y) path = | |
if x + dx |> between 0 width && y + dy |> between 0 height | |
then Some((x+dx, y+dy), path + direction) | |
else None | |
let up = step "U" (0, -1) | |
let down = step "D" (0, 1) | |
let left = step "L" (-1, 0) | |
let right = step "R" (1, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment