Day 14. Best one yet!

master
Dustin Swan 2 years ago
parent 86c696e61b
commit 2cd9f24083
Signed by: dustinswan
GPG Key ID: AB49BD6B2B3A6377

7
day14/Cargo.lock generated

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day14"
version = "0.1.0"

@ -0,0 +1,8 @@
[package]
name = "day14"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

@ -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

@ -0,0 +1,123 @@
use std::collections::HashMap;
#[derive(Debug, Clone)]
enum Pixel {
Wall,
Sand,
Source,
}
fn main() {
let contents = std::fs::read_to_string("data.txt").expect("Failed to read file");
let paths = contents
.lines()
.map(parse)
.collect::<Vec<Vec<(usize, usize)>>>();
let mut cave: HashMap<(usize, usize), Pixel> = HashMap::new();
cave.insert((500, 0), Pixel::Source);
create_cave(&mut cave, paths.clone());
// Part 1
simulate(&mut cave.clone());
// Part 2
add_floor(&mut cave);
simulate(&mut cave);
}
fn parse(line: &str) -> Vec<(usize, usize)> {
line.split(" -> ")
.map(|c| c.split_once(",").unwrap())
.map(|(l, r)| (l.parse().unwrap(), r.parse().unwrap()))
.collect::<Vec<(usize, usize)>>()
}
fn create_cave(cave: &mut HashMap<(usize, usize), Pixel>, paths: Vec<Vec<(usize, usize)>>) -> () {
for path in paths {
for i in 0..path.len() - 1 {
let (x1, y1) = path[i];
let (x2, y2) = path[i + 1];
for x in if x1 < x2 { x1..=x2 } else { x2..=x1 } {
cave.insert((x, y1), Pixel::Wall);
}
for y in if y1 < y2 { y1..=y2 } else { y2..=y1 } {
cave.insert((x1, y), Pixel::Wall);
}
}
}
}
fn draw_cave(cave: &HashMap<(usize, usize), Pixel>) -> () {
let x_min = cave.keys().map(|(x, y)| x).min().unwrap();
let y_min = cave.keys().map(|(x, y)| y).min().unwrap();
let x_max = cave.keys().map(|(x, y)| x).max().unwrap();
let y_max = cave.keys().map(|(x, y)| y).max().unwrap();
for y in *y_min..=*y_max {
print!("{y} ");
for x in *x_min..=*x_max {
match cave.get(&(x, y)) {
Some(Pixel::Wall) => print!("#"),
Some(Pixel::Sand) => print!("o"),
Some(Pixel::Source) => print!("+"),
_ => print!("."),
}
}
println!();
}
}
fn simulate(cave: &mut HashMap<(usize, usize), Pixel>) -> () {
let mut grains = 1;
while drop_sand(cave) {
draw_cave(cave);
println!("Grains: {grains}");
grains = grains+1;
}
}
fn drop_sand(cave: &mut HashMap<(usize, usize), Pixel>) -> bool {
let mut sand = (500, 0);
let mut falling = true;
while falling {
if cave.get(&(sand.0, sand.1 + 1)).is_none() {
// sand beats down
sand = (sand.0, sand.1 + 1);
// Part 1 ends when it falls forever (or to 500)
if sand.1 > 500 {
return false;
}
} else {
if cave.get(&(sand.0 - 1, sand.1 + 1)).is_none() {
// check down and left
sand = (sand.0 - 1, sand.1 + 1);
} else if cave.get(&(sand.0 + 1, sand.1 + 1)).is_none() {
// check down and right
sand = (sand.0 + 1, sand.1 + 1);
} else {
// neither are open
cave.insert((sand.0, sand.1), Pixel::Sand);
falling = false;
// Part 2 ends when it hits sand immediately
if sand.1 == 0 {
return false;
}
}
}
}
return true;
}
fn add_floor(cave: &mut HashMap<(usize, usize), Pixel>) -> () {
let y = cave.keys().map(|(_, y)| y).max().unwrap().to_owned();
for x in 0..1000 {
cave.insert((x, y + 2), Pixel::Wall);
}
}

@ -0,0 +1,2 @@
498,4 -> 498,6 -> 496,6
503,4 -> 502,4 -> 502,9 -> 494,9
Loading…
Cancel
Save