import simplifile as file
28
-
let assert Ok(direction_letter) = string.first(l)
29
-
let direction = case direction_letter {
29
+
let #(direction, turn) = case l {
30
+
"R" <> turn -> #(Right, turn)
31
+
"L" <> turn -> #(Left, turn)
_ -> panic as "bad input"
34
-
let assert Ok(turn) = string.drop_start(l, 1) |> int.parse
35
-
InputEntry(direction, turn)
34
+
InputEntry(direction, turn |> int.parse |> result.unwrap(0))
|> list.fold(RotationState(50, 0), fn(acc, v) {
// took too long to remember that abs isn't this im so fucking stupid
74
-
let new_number = raw_new_number % 100
75
-
// this seems to be useless here but i might be a genius who put it preventively
76
-
let new_number = case new_number > 0 {
78
-
False -> 100 + new_number
74
+
let new_number = int.modulo(raw_new_number, 100) |> result.unwrap(0)
// dumbest fuck in the world??? theres gotta be a mathy way of doing this
list.range(acc.number, raw_new_number)