day 13 python solution

main
magical 2022-12-13 21:45:47 -08:00
parent 85e623a9db
commit 96a5961ed4
3 changed files with 291 additions and 0 deletions

169
day14/input 100644
View File

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

2
day14/sample 100644
View File

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

120
day14/sol.py 100644
View File

@ -0,0 +1,120 @@
source = (500,0)
data = []
xs = []
ys = []
for line in open("input"):
path = []
for point in line.replace("->", " ").split():
x, y = map(int, point.split(","))
path.append((x,y))
xs.append(x)
ys.append(y)
data.append(path)
grid = []
sand = {}
X0 = min(xs)
X1 = max(xs) + 1
Y0 = 0
Y1 = max(ys) + 1
# part 2:
X0 -= 1000
X1 += 1000
Y1 += 1
DX = X1 - X0
DY = Y1 - Y0
grid = [['.']*DX for _ in range(DY)]
def put(x,y,c):
if c == 'o':
sand[(x,y)] = c
if X0 <= x < X1:
if Y0 <= y < Y1:
grid[y-Y0][x-X0] = c
return
print(x,y,"out of range")
def get(x,y):
if (x,y) in sand:
return 'o'
if X0 <= x < X1:
if Y0 <= y < Y1:
return grid[y-Y0][x-X0]
return '#'
def draw(path):
for p1, p2 in zip(path, path[1:]):
#print(p1, p2)
if p1[0] == p2[0]:
x = p1[0]
y0, y1 = p1[1], p2[1]
if y0 > y1:
y0, y1 = y1, y0
for y in range(y0, y1+1):
put(x,y, '#')
else:
y = p1[1]
x0, x1 = p1[0], p2[0]
if x0 > x1:
x0, x1 = x1, x0
for x in range(x0, x1+1):
put(x,y, '#')
for path in data:
#print(path)
draw(path)
def show():
for r in grid: print("".join(r))
#show()
def drip(p):
x,y=p
while True:
c = get(x,y+1)
if c == '?':
return 'bye'
if c == '.':
y += 1
continue
# try left
c = get(x-1,y+1)
if c == '?':
return 'bye'
if c == '.':
x,y = x-1,y+1
continue
# try right
c = get(x+1, y+1)
if c == '?':
return 'bye'
if c == '.':
x,y = x+1, y+1
continue
# blocked!
put(x,y,'o')
#print(x,y)
return 'done'
#i = 0
#for _ in range(100000):
# if drip(source) == 'bye':
# break
# i+= 1
i = 0
while source not in sand:
drip(source)
i += 1
#show()
print(i)