Created
September 26, 2020 13:48
-
-
Save windmaomao/33758a5df8dd76f56665a55f539eef27 to your computer and use it in GitHub Desktop.
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
// 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