diff options
Diffstat (limited to 'src/2022/day17/aoc.cpp')
-rw-r--r-- | src/2022/day17/aoc.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/2022/day17/aoc.cpp b/src/2022/day17/aoc.cpp index c9d0dca..d57742b 100644 --- a/src/2022/day17/aoc.cpp +++ b/src/2022/day17/aoc.cpp @@ -4,6 +4,7 @@ namespace aoc2022 { static line_view moves; +static size_t index = 0; static bool at(uint8_t r, int p) { // p 0..7 @@ -14,8 +15,7 @@ static bool at(uint8_t r, int p) { } char next() { - static int i{0}; - int x = i++ % (moves.length - 1); + int x = index++ % (moves.length - 1); const char* p = moves.line; // printf("%c at %d\n", *(p + x), x); return *(p + x); @@ -194,15 +194,21 @@ std::pair<size_t, size_t> day17(line_view file) { rock17 floor{chamber, {0x7F}}; std::map<size_t, size_t> heights; - // size_t n = (file.length - 1) * 5; + // size_t p = (file.length - 1) * 5; size_t n = 2022; + // sample 17 35/35/35 + // input 8602 8575/8575/8575 for (size_t i = 0; i < n; i++) { rock17 r = make_rock(i); check_three(floor.rs); + // auto x = check_three(floor.rs); + // if (x == 0) { + // printf("%ld, %ld\n", i, index % p); + // } merge(floor, r, 0); } - print(floor.rs); - printf("%ld\n", floor.rs.size() - 1); + // print(floor.rs); + printf("%ld %ld\n", floor.rs.size() - 1, index); return {0, 0}; } } // namespace aoc2022 |