commit 486b135a0aabd6544748c50152121da0e31fb2bf (patch)
parent 00daf031374f5b3671df643f81d0506c5fc02278
Author: Alex Karle <alex@alexkarle.com>
Date: Wed, 14 Dec 2022 23:02:32 -0500
day14: Add part 1 solution (so satisfying to watch!)
Diffstat:
A | 2022/14/input | | | 169 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2022/14/sample | | | 2 | ++ |
A | 2022/14/sol.scm | | | 101 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
3 files changed, 272 insertions(+), 0 deletions(-)
diff --git a/2022/14/input b/2022/14/input
@@ -0,0 +1,169 @@
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+545,125 -> 549,125
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+500,34 -> 500,37 -> 496,37 -> 496,40 -> 506,40 -> 506,37 -> 504,37 -> 504,34
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+539,150 -> 539,152 -> 534,152 -> 534,159 -> 544,159 -> 544,152 -> 543,152 -> 543,150
+500,34 -> 500,37 -> 496,37 -> 496,40 -> 506,40 -> 506,37 -> 504,37 -> 504,34
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+558,119 -> 563,119
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+539,131 -> 543,131
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+526,82 -> 530,82
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+548,122 -> 553,122
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+500,34 -> 500,37 -> 496,37 -> 496,40 -> 506,40 -> 506,37 -> 504,37 -> 504,34
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+523,84 -> 527,84
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+551,119 -> 556,119
+529,84 -> 533,84
+505,62 -> 509,62
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+526,86 -> 530,86
+548,128 -> 552,128
+500,34 -> 500,37 -> 496,37 -> 496,40 -> 506,40 -> 506,37 -> 504,37 -> 504,34
+504,19 -> 504,23 -> 503,23 -> 503,31 -> 512,31 -> 512,23 -> 507,23 -> 507,19
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+523,88 -> 527,88
+551,131 -> 555,131
+541,122 -> 546,122
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+517,88 -> 521,88
+504,19 -> 504,23 -> 503,23 -> 503,31 -> 512,31 -> 512,23 -> 507,23 -> 507,19
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+562,122 -> 567,122
+539,150 -> 539,152 -> 534,152 -> 534,159 -> 544,159 -> 544,152 -> 543,152 -> 543,150
+532,82 -> 536,82
+505,58 -> 509,58
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+502,60 -> 506,60
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+535,88 -> 539,88
+554,134 -> 558,134
+539,150 -> 539,152 -> 534,152 -> 534,159 -> 544,159 -> 544,152 -> 543,152 -> 543,150
+500,34 -> 500,37 -> 496,37 -> 496,40 -> 506,40 -> 506,37 -> 504,37 -> 504,34
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+508,56 -> 512,56
+540,91 -> 540,92 -> 547,92 -> 547,91
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+540,91 -> 540,92 -> 547,92 -> 547,91
+521,65 -> 521,67 -> 513,67 -> 513,72 -> 526,72 -> 526,67 -> 523,67 -> 523,65
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+499,62 -> 503,62
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+548,134 -> 552,134
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+542,134 -> 546,134
+518,76 -> 518,77 -> 530,77 -> 530,76
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+544,119 -> 549,119
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+493,15 -> 493,16 -> 504,16 -> 504,15
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+542,128 -> 546,128
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+540,91 -> 540,92 -> 547,92 -> 547,91
+511,58 -> 515,58
+500,34 -> 500,37 -> 496,37 -> 496,40 -> 506,40 -> 506,37 -> 504,37 -> 504,34
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+538,86 -> 542,86
+521,65 -> 521,67 -> 513,67 -> 513,72 -> 526,72 -> 526,67 -> 523,67 -> 523,65
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+504,19 -> 504,23 -> 503,23 -> 503,31 -> 512,31 -> 512,23 -> 507,23 -> 507,19
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+508,60 -> 512,60
+517,62 -> 521,62
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+518,76 -> 518,77 -> 530,77 -> 530,76
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+493,15 -> 493,16 -> 504,16 -> 504,15
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+521,65 -> 521,67 -> 513,67 -> 513,72 -> 526,72 -> 526,67 -> 523,67 -> 523,65
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+547,116 -> 552,116
+504,19 -> 504,23 -> 503,23 -> 503,31 -> 512,31 -> 512,23 -> 507,23 -> 507,19
+539,150 -> 539,152 -> 534,152 -> 534,159 -> 544,159 -> 544,152 -> 543,152 -> 543,150
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+504,19 -> 504,23 -> 503,23 -> 503,31 -> 512,31 -> 512,23 -> 507,23 -> 507,19
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+521,65 -> 521,67 -> 513,67 -> 513,72 -> 526,72 -> 526,67 -> 523,67 -> 523,65
+518,76 -> 518,77 -> 530,77 -> 530,76
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+541,88 -> 545,88
+504,19 -> 504,23 -> 503,23 -> 503,31 -> 512,31 -> 512,23 -> 507,23 -> 507,19
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+555,122 -> 560,122
+521,65 -> 521,67 -> 513,67 -> 513,72 -> 526,72 -> 526,67 -> 523,67 -> 523,65
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+532,86 -> 536,86
+539,150 -> 539,152 -> 534,152 -> 534,159 -> 544,159 -> 544,152 -> 543,152 -> 543,150
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+539,150 -> 539,152 -> 534,152 -> 534,159 -> 544,159 -> 544,152 -> 543,152 -> 543,150
+550,113 -> 555,113
+554,116 -> 559,116
+521,65 -> 521,67 -> 513,67 -> 513,72 -> 526,72 -> 526,67 -> 523,67 -> 523,65
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+514,60 -> 518,60
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+535,84 -> 539,84
+521,65 -> 521,67 -> 513,67 -> 513,72 -> 526,72 -> 526,67 -> 523,67 -> 523,65
+511,62 -> 515,62
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+529,80 -> 533,80
+545,131 -> 549,131
+503,53 -> 503,50 -> 503,53 -> 505,53 -> 505,51 -> 505,53 -> 507,53 -> 507,52 -> 507,53 -> 509,53 -> 509,50 -> 509,53
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+504,19 -> 504,23 -> 503,23 -> 503,31 -> 512,31 -> 512,23 -> 507,23 -> 507,19
+539,150 -> 539,152 -> 534,152 -> 534,159 -> 544,159 -> 544,152 -> 543,152 -> 543,150
+536,172 -> 536,168 -> 536,172 -> 538,172 -> 538,164 -> 538,172 -> 540,172 -> 540,168 -> 540,172 -> 542,172 -> 542,163 -> 542,172 -> 544,172 -> 544,164 -> 544,172 -> 546,172 -> 546,171 -> 546,172 -> 548,172 -> 548,165 -> 548,172 -> 550,172 -> 550,170 -> 550,172 -> 552,172 -> 552,170 -> 552,172
+554,110 -> 563,110
+539,105 -> 539,98 -> 539,105 -> 541,105 -> 541,100 -> 541,105 -> 543,105 -> 543,103 -> 543,105 -> 545,105 -> 545,101 -> 545,105 -> 547,105 -> 547,95 -> 547,105 -> 549,105 -> 549,104 -> 549,105 -> 551,105 -> 551,99 -> 551,105 -> 553,105 -> 553,97 -> 553,105 -> 555,105 -> 555,96 -> 555,105
+493,15 -> 493,16 -> 504,16 -> 504,15
+529,88 -> 533,88
+527,147 -> 527,139 -> 527,147 -> 529,147 -> 529,142 -> 529,147 -> 531,147 -> 531,138 -> 531,147 -> 533,147 -> 533,137 -> 533,147 -> 535,147 -> 535,140 -> 535,147 -> 537,147 -> 537,146 -> 537,147 -> 539,147 -> 539,142 -> 539,147 -> 541,147 -> 541,140 -> 541,147
+536,134 -> 540,134
+500,34 -> 500,37 -> 496,37 -> 496,40 -> 506,40 -> 506,37 -> 504,37 -> 504,34
+520,86 -> 524,86
diff --git a/2022/14/sample b/2022/14/sample
@@ -0,0 +1,2 @@
+498,4 -> 498,6 -> 496,6
+503,4 -> 502,4 -> 502,9 -> 494,9
diff --git a/2022/14/sol.scm b/2022/14/sol.scm
@@ -0,0 +1,101 @@
+#!/usr/local/bin/chicken-csi -ss
+(import srfi-69
+ (chicken string)
+ (chicken io))
+
+;; parse a line into a list of all points covered by rocks
+(define (parse-line line)
+ (let ((pairs (map (lambda (p) (map string->number (string-split p ",")))
+ (string-split line " ->"))))
+ (let loop ((points '()) (ps pairs))
+ (if (null? (cdr ps))
+ points
+ (let ((x1 (car (car ps))) (y1 (cadr (car ps)))
+ (x2 (car (cadr ps))) (y2 (cadr (cadr ps))))
+ (cond ((and (= x1 x2) (not (= y1 y2)))
+ (loop (append points
+ (zip (n-of-v (add1 (abs (- y1 y2))) x1)
+ (range y1 y2)))
+ (cdr ps)))
+ ((and (= y1 y2) (not (= x1 x2)))
+ (loop (append points
+ (zip (range x1 x2)
+ (n-of-v (add1 (abs (- x1 x2))) y1)))
+ (cdr ps)))
+ (else "More than one dim changed")))))))
+
+; [s, ..., f] inclusive
+(define (range s f)
+ (let ((next (if (<= s f) add1 sub1)))
+ (if (equal? s f)
+ (list f)
+ (cons s (range (next s) f)))))
+
+(define (n-of-v n v)
+ (if (= n 0)
+ '()
+ (cons v (n-of-v (sub1 n) v))))
+
+(define (zip l1 l2)
+ (if (not (= (length l1) (length l2)))
+ (error "Bad zip: lengths not equal"))
+ (if (null? l1)
+ '()
+ (cons (list (car l1) (car l2)) (zip (cdr l1) (cdr l2)))))
+
+(define (print-grid G)
+ (let* ((keys (hash-table-keys G))
+ (max-x (apply max (map (lambda (pt) (car pt)) keys)))
+ (min-x (apply min (map (lambda (pt) (car pt)) keys)))
+ (max-y (apply max (map (lambda (pt) (cadr pt)) keys)))
+ (min-y 0))
+ (let yloop ((y min-y))
+ (newline)
+ (if (> y max-y)
+ 'done
+ (let xloop ((x min-x))
+ (if (> x max-x)
+ (yloop (add1 y))
+ (cond ((hash-table-exists? G (list x y))
+ (display (hash-table-ref G (list x y)))
+ (xloop (add1 x)))
+ (else (display ".")
+ (xloop (add1 x))))))))))
+
+; just for brevity
+(define (empty? G x y) (not (hash-table-exists? G (list x y))))
+
+(define (drop-sand G x y cliff)
+ (cond ((> y cliff) ; fell off the map -> we're done
+ #f)
+ ((empty? G x (add1 y))
+ (drop-sand G x (add1 y) cliff))
+ ; we're blocked at this point, try left/right
+ ((empty? G (sub1 x) (add1 y))
+ (drop-sand G (sub1 x) (add1 y) cliff))
+ ((empty? G (add1 x) (add1 y))
+ (drop-sand G (add1 x) (add1 y) cliff))
+ (else
+ (hash-table-set! G (list x y) 'o))))
+
+;; We map the world state as a hash table (effectively a sparse matrix)
+;; so that we don't have to guess the vector dimensions first
+(define (main args)
+ (let ((G (make-hash-table)) (lines (read-lines)))
+ (hash-table-set! G '(500 0) 'V)
+ (for-each (lambda (l)
+ (for-each (lambda (pt)
+ (hash-table-set! G pt 'R)) (parse-line l)))
+ lines)
+ (let ((cliff (apply max (map (lambda (pt) (cadr pt)) (hash-table-keys G)))))
+ ;; note: could also just count the number of 'o values instead of i
+ (let loop ((i 0))
+ ; (print "------" i "-------")
+ ; (print-grid G)
+ (if (drop-sand G 500 0 cliff)
+ (loop (add1 i))
+ (print i))))))
+
+; For repl
+(define ls '("498,4 -> 498,6 -> 496,6"
+ "503,4 -> 502,4 -> 502,9 -> 494,9"))