Skip to content

Instantly share code, notes, and snippets.

@windmaomao
Created September 26, 2020 13:48
Show Gist options
  • Save windmaomao/33758a5df8dd76f56665a55f539eef27 to your computer and use it in GitHub Desktop.
Save windmaomao/33758a5df8dd76f56665a55f539eef27 to your computer and use it in GitHub Desktop.
// aoc2015-day3-nextPos
private val len = 10000
fun nextPos(acc: Int, c: Char) = when(c) {
'^' -> acc + len
'v' -> acc - len
'>' -> acc + 1
'<' -> acc - 1
else -> acc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment