Skip to content

Commit

Permalink
it now does part 1 again correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Dec 26, 2024
1 parent 5c47c60 commit f6bf4c3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/aoc2024/day21/part2.jou
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import "stdlib/io.jou"
import "stdlib/ascii.jou"
import "stdlib/math.jou"
import "stdlib/mem.jou"
import "stdlib/str.jou"


Expand Down Expand Up @@ -38,15 +37,15 @@ class KeyPad:
#
# Return value = how many times total the keys on last keypad were pressed.
def press_key(keypads: KeyPad*, nkeypads: int, key_to_press: byte) -> long:
printf("Press '%c'\n", key_to_press)
fflush(stdout)
# printf("Press '%c'\n", key_to_press)
# fflush(stdout)

if nkeypads == 1:
# Human is typing here, let's simply count the key presses.
# We don't care what they are, just how many.
printf(" --> trivial\n")
fflush(stdout)
getchar()
# printf("user presses '%c'\n", key_to_press)
# fflush(stdout)
# #getchar()
return 1

pos = keypads[0].find_key(key_to_press)
Expand Down Expand Up @@ -146,6 +145,7 @@ def main() -> int:
numeric_keypad,
arrow_keypad,
arrow_keypad,
arrow_keypad,
]

# Aim each keypad to the previous (closer to door) keypad's A button
Expand Down

0 comments on commit f6bf4c3

Please sign in to comment.