summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-12-22 22:23:01 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-12-22 22:23:01 +0200
commita3c39206a35e4ecf867a368108afe7002d8b4d17 (patch)
treee41d35ed31d6a9d76100ddc43a05ed73755628b1
parentf92617828df7fe9974ba3afc94b6ff338d25bd9b (diff)
Day 22 parsing
-rw-r--r--2023/inputs/day_22.txt1206
-rw-r--r--2023/src/bin/day_22.rs44
2 files changed, 1243 insertions, 7 deletions
diff --git a/2023/inputs/day_22.txt b/2023/inputs/day_22.txt
new file mode 100644
index 0000000..1cdf927
--- /dev/null
+++ b/2023/inputs/day_22.txt
@@ -0,0 +1,1206 @@
+9,1,102~9,3,102
+4,8,146~8,8,146
+5,8,160~6,8,160
+5,8,77~7,8,77
+9,5,174~9,8,174
+2,7,104~2,8,104
+4,0,208~4,4,208
+5,2,232~7,2,232
+8,4,294~8,7,294
+1,3,306~2,3,306
+3,8,2~5,8,2
+5,0,149~5,1,149
+6,1,265~9,1,265
+0,4,297~3,4,297
+4,3,242~4,3,242
+0,3,196~0,6,196
+5,0,152~7,0,152
+3,4,22~3,4,24
+8,0,5~8,3,5
+4,8,190~8,8,190
+7,9,148~8,9,148
+7,7,195~9,7,195
+5,7,53~5,9,53
+3,1,170~3,2,170
+2,4,305~2,4,307
+6,5,190~6,7,190
+3,4,46~5,4,46
+4,4,171~7,4,171
+1,2,30~1,4,30
+4,6,79~6,6,79
+7,8,235~8,8,235
+2,4,226~5,4,226
+3,5,181~5,5,181
+6,9,58~8,9,58
+0,0,158~2,0,158
+1,4,90~4,4,90
+0,9,259~2,9,259
+3,6,273~3,9,273
+4,1,135~6,1,135
+5,6,187~8,6,187
+8,0,259~8,2,259
+5,3,37~7,3,37
+4,0,96~5,0,96
+2,8,135~2,9,135
+6,6,124~6,8,124
+6,8,143~7,8,143
+1,1,180~4,1,180
+2,4,148~4,4,148
+8,0,62~8,1,62
+0,8,1~0,9,1
+7,5,6~9,5,6
+3,4,107~5,4,107
+2,0,3~2,0,5
+0,3,3~2,3,3
+2,5,15~5,5,15
+1,9,7~4,9,7
+1,0,238~4,0,238
+6,5,93~8,5,93
+9,5,211~9,7,211
+0,6,91~2,6,91
+1,4,248~3,4,248
+6,4,98~6,7,98
+2,2,222~3,2,222
+6,9,140~7,9,140
+7,0,158~8,0,158
+6,5,147~6,7,147
+1,4,301~1,7,301
+0,3,143~0,3,145
+5,7,252~8,7,252
+3,7,68~3,9,68
+5,4,250~5,6,250
+3,0,146~5,0,146
+5,5,194~7,5,194
+3,2,281~3,5,281
+0,5,255~0,7,255
+1,6,99~1,8,99
+3,0,240~5,0,240
+3,2,223~3,2,225
+0,6,4~0,9,4
+8,3,256~8,6,256
+1,5,41~1,7,41
+2,7,175~2,8,175
+2,2,193~4,2,193
+8,7,60~8,9,60
+6,8,302~8,8,302
+5,2,245~6,2,245
+3,4,102~3,7,102
+1,5,160~1,7,160
+5,5,26~9,5,26
+4,5,123~4,5,126
+2,6,169~5,6,169
+2,4,64~3,4,64
+1,4,151~3,4,151
+5,5,98~5,7,98
+8,1,86~8,2,86
+4,0,228~4,1,228
+6,2,291~6,5,291
+0,3,108~0,6,108
+2,9,281~3,9,281
+0,5,175~3,5,175
+7,7,89~7,8,89
+3,3,82~3,5,82
+2,5,290~2,6,290
+3,0,284~3,2,284
+9,9,68~9,9,70
+3,9,278~6,9,278
+8,1,59~8,2,59
+5,9,254~8,9,254
+3,4,155~3,6,155
+8,6,208~8,8,208
+5,4,17~7,4,17
+5,2,110~6,2,110
+9,2,168~9,3,168
+5,6,278~7,6,278
+6,7,178~8,7,178
+7,7,86~8,7,86
+5,1,244~7,1,244
+1,0,114~3,0,114
+9,3,210~9,5,210
+0,3,280~1,3,280
+7,0,104~9,0,104
+0,6,210~2,6,210
+0,5,227~1,5,227
+6,1,175~6,4,175
+0,2,34~2,2,34
+2,4,115~2,7,115
+0,9,134~2,9,134
+5,1,220~5,4,220
+2,3,124~4,3,124
+5,9,276~6,9,276
+9,4,128~9,6,128
+0,2,171~2,2,171
+1,8,297~3,8,297
+9,3,166~9,4,166
+0,5,165~3,5,165
+3,9,76~6,9,76
+0,9,6~1,9,6
+7,3,242~7,5,242
+9,3,100~9,3,101
+6,3,101~6,6,101
+4,5,111~5,5,111
+5,4,115~5,5,115
+5,4,96~5,4,97
+6,6,111~9,6,111
+3,0,222~4,0,222
+6,6,72~6,7,72
+2,7,200~2,8,200
+1,1,145~3,1,145
+9,7,279~9,7,279
+3,7,127~6,7,127
+3,7,225~3,8,225
+7,9,151~8,9,151
+2,6,20~3,6,20
+8,7,93~9,7,93
+9,3,248~9,5,248
+0,5,143~0,7,143
+5,1,264~7,1,264
+4,4,91~6,4,91
+0,5,171~2,5,171
+5,6,277~5,8,277
+0,6,293~3,6,293
+2,3,194~2,5,194
+7,4,192~7,6,192
+3,5,118~5,5,118
+0,7,282~1,7,282
+6,0,183~6,2,183
+4,8,299~6,8,299
+8,5,155~8,6,155
+5,8,122~7,8,122
+5,1,95~5,3,95
+5,7,54~7,7,54
+7,0,262~9,0,262
+2,2,139~5,2,139
+0,0,161~0,0,164
+6,0,198~6,4,198
+2,7,225~2,7,228
+5,4,62~5,6,62
+2,5,40~2,6,40
+2,2,226~2,2,226
+0,3,132~3,3,132
+4,1,131~4,3,131
+5,8,84~6,8,84
+3,1,55~4,1,55
+9,6,255~9,9,255
+7,2,136~7,4,136
+7,6,249~7,7,249
+4,3,148~6,3,148
+3,2,17~6,2,17
+3,8,64~6,8,64
+0,7,107~0,8,107
+7,0,247~7,1,247
+1,4,148~1,6,148
+4,7,134~4,8,134
+1,6,138~4,6,138
+7,2,54~9,2,54
+0,4,47~0,7,47
+2,5,152~4,5,152
+2,0,143~3,0,143
+0,1,151~2,1,151
+9,7,1~9,9,1
+4,3,34~5,3,34
+2,4,84~4,4,84
+3,2,81~5,2,81
+8,4,186~8,6,186
+1,7,237~2,7,237
+1,3,51~1,4,51
+2,6,286~2,8,286
+2,5,183~4,5,183
+0,2,64~3,2,64
+1,4,158~3,4,158
+5,1,46~6,1,46
+3,8,204~3,8,206
+5,9,64~7,9,64
+5,5,262~7,5,262
+7,5,188~7,7,188
+7,6,155~7,7,155
+4,4,151~5,4,151
+2,5,188~2,5,190
+8,2,48~8,4,48
+7,7,232~7,8,232
+7,1,10~7,1,12
+5,8,102~5,8,104
+8,2,119~8,6,119
+3,3,11~5,3,11
+4,5,295~6,5,295
+8,4,173~9,4,173
+6,3,236~6,5,236
+7,0,159~7,0,160
+2,4,89~2,7,89
+9,8,51~9,8,52
+2,5,72~2,7,72
+3,3,166~3,5,166
+5,2,136~5,4,136
+5,7,177~7,7,177
+0,5,238~2,5,238
+8,2,142~8,2,143
+1,7,230~1,8,230
+6,3,67~8,3,67
+4,4,123~5,4,123
+3,1,311~3,3,311
+7,0,102~9,0,102
+1,9,138~3,9,138
+8,5,248~8,6,248
+7,6,199~9,6,199
+7,8,268~9,8,268
+7,5,176~7,7,176
+1,6,287~2,6,287
+3,1,286~3,1,289
+9,5,250~9,5,253
+4,2,293~6,2,293
+5,7,173~7,7,173
+0,4,107~0,6,107
+3,5,103~3,6,103
+4,0,103~4,3,103
+1,1,276~1,5,276
+4,9,18~6,9,18
+4,9,97~6,9,97
+1,5,234~1,7,234
+3,5,246~3,8,246
+1,0,182~2,0,182
+7,4,193~8,4,193
+4,8,78~6,8,78
+0,6,42~0,6,44
+7,8,186~7,9,186
+1,5,72~1,7,72
+2,2,144~2,4,144
+7,4,226~7,7,226
+9,3,94~9,7,94
+4,3,304~4,6,304
+9,0,216~9,0,217
+5,0,65~5,2,65
+7,1,174~7,4,174
+2,7,197~2,9,197
+1,2,303~1,4,303
+6,3,94~6,5,94
+7,4,23~7,6,23
+2,8,106~4,8,106
+0,2,65~1,2,65
+5,2,238~5,4,238
+4,5,257~7,5,257
+4,4,131~4,6,131
+2,3,54~2,6,54
+0,7,209~3,7,209
+9,4,131~9,6,131
+0,9,40~3,9,40
+5,5,150~5,7,150
+7,0,149~7,0,150
+6,7,152~8,7,152
+2,7,231~2,9,231
+0,1,1~0,1,3
+5,5,120~5,7,120
+2,5,197~4,5,197
+5,0,78~5,2,78
+5,0,137~5,1,137
+0,3,210~0,5,210
+0,2,113~0,2,115
+3,7,149~3,7,152
+5,8,225~8,8,225
+6,5,240~8,5,240
+2,5,25~3,5,25
+0,0,156~2,0,156
+6,9,149~9,9,149
+3,0,296~3,0,298
+9,0,211~9,0,213
+9,5,276~9,7,276
+2,1,203~4,1,203
+0,8,235~2,8,235
+1,5,111~1,7,111
+8,9,206~8,9,208
+7,0,99~7,2,99
+1,1,143~2,1,143
+1,7,281~3,7,281
+6,3,43~6,6,43
+2,3,187~2,5,187
+3,5,108~3,7,108
+1,4,299~4,4,299
+1,2,141~1,3,141
+9,3,175~9,5,175
+9,2,43~9,5,43
+6,9,137~6,9,139
+0,0,71~0,2,71
+1,7,249~3,7,249
+2,3,31~4,3,31
+3,5,17~5,5,17
+4,6,90~4,6,92
+3,0,173~3,1,173
+9,5,256~9,7,256
+8,5,127~8,6,127
+8,0,176~9,0,176
+2,5,221~2,7,221
+7,6,263~7,7,263
+1,2,93~1,4,93
+2,9,71~4,9,71
+1,7,145~4,7,145
+2,2,292~2,5,292
+9,5,58~9,8,58
+0,7,229~2,7,229
+8,5,243~8,7,243
+3,7,5~3,9,5
+4,0,153~4,2,153
+4,3,104~5,3,104
+2,4,18~2,6,18
+0,2,170~0,5,170
+3,5,94~5,5,94
+1,5,74~3,5,74
+3,6,37~3,9,37
+7,4,30~7,6,30
+1,9,191~5,9,191
+5,3,217~8,3,217
+1,6,3~1,8,3
+9,6,125~9,9,125
+6,8,269~8,8,269
+2,7,11~4,7,11
+0,3,113~1,3,113
+3,3,157~6,3,157
+1,7,214~1,7,217
+9,5,95~9,8,95
+1,5,224~4,5,224
+2,9,235~3,9,235
+2,1,158~2,1,160
+5,2,228~6,2,228
+3,9,69~5,9,69
+0,1,224~0,4,224
+8,4,254~8,6,254
+8,4,281~8,6,281
+0,5,166~0,5,168
+6,6,239~9,6,239
+0,7,250~2,7,250
+7,0,234~7,3,234
+2,9,94~5,9,94
+3,6,129~3,9,129
+5,0,89~6,0,89
+5,0,154~5,0,157
+2,2,4~4,2,4
+4,1,231~4,1,232
+4,6,110~4,6,112
+5,4,108~5,6,108
+6,4,240~6,4,242
+1,6,220~3,6,220
+9,6,176~9,7,176
+2,1,190~2,4,190
+0,0,173~0,2,173
+6,8,125~6,9,125
+1,8,25~4,8,25
+0,6,104~0,9,104
+1,9,200~4,9,200
+5,1,241~5,3,241
+2,6,23~3,6,23
+3,6,189~5,6,189
+6,0,204~6,2,204
+5,7,145~5,9,145
+4,2,164~6,2,164
+4,8,119~7,8,119
+6,5,251~8,5,251
+2,7,75~4,7,75
+7,3,260~7,6,260
+5,8,163~6,8,163
+7,3,166~7,6,166
+5,5,268~7,5,268
+7,2,171~9,2,171
+4,1,68~5,1,68
+1,8,2~2,8,2
+1,1,36~3,1,36
+5,9,188~7,9,188
+6,2,24~6,4,24
+7,1,145~7,2,145
+3,3,149~3,6,149
+2,0,30~2,2,30
+8,3,165~8,3,166
+0,1,92~0,1,94
+7,1,141~7,3,141
+2,5,210~2,5,211
+7,2,52~8,2,52
+2,7,148~5,7,148
+6,8,15~7,8,15
+9,3,5~9,5,5
+2,3,214~4,3,214
+0,3,150~0,5,150
+8,4,245~8,4,247
+1,6,107~4,6,107
+1,3,66~1,3,66
+3,0,115~5,0,115
+0,5,118~0,7,118
+9,0,56~9,2,56
+8,1,243~8,1,245
+0,6,141~2,6,141
+4,0,286~7,0,286
+4,1,113~6,1,113
+6,7,186~6,8,186
+3,3,6~3,3,8
+9,4,201~9,4,203
+9,4,246~9,7,246
+4,8,277~4,9,277
+5,3,271~5,6,271
+7,3,21~7,6,21
+7,1,133~7,3,133
+5,5,157~5,8,157
+2,0,231~4,0,231
+3,0,112~5,0,112
+0,9,286~1,9,286
+4,4,264~4,6,264
+0,0,242~0,3,242
+2,7,257~2,9,257
+4,9,164~4,9,166
+3,4,300~5,4,300
+9,8,53~9,8,55
+4,1,59~4,4,59
+0,4,112~2,4,112
+0,0,41~1,0,41
+6,5,266~6,8,266
+4,4,23~5,4,23
+1,8,90~1,9,90
+7,0,297~7,3,297
+7,6,245~9,6,245
+0,3,216~0,5,216
+0,3,33~2,3,33
+4,8,120~6,8,120
+7,5,254~7,6,254
+2,5,77~4,5,77
+3,6,111~3,6,114
+7,3,112~7,5,112
+3,7,212~4,7,212
+4,6,231~4,8,231
+7,2,2~8,2,2
+1,1,248~1,3,248
+0,5,92~3,5,92
+1,7,213~3,7,213
+6,4,95~6,6,95
+1,3,227~3,3,227
+7,0,207~7,0,208
+5,0,86~7,0,86
+8,3,105~8,3,107
+2,6,1~4,6,1
+0,4,94~0,7,94
+0,3,63~2,3,63
+4,7,193~4,8,193
+3,1,290~3,4,290
+5,8,254~8,8,254
+6,6,193~6,6,195
+0,2,67~1,2,67
+2,1,33~3,1,33
+4,6,55~6,6,55
+3,3,129~6,3,129
+9,0,110~9,1,110
+0,3,178~0,6,178
+4,7,138~6,7,138
+1,0,179~1,3,179
+8,1,268~9,1,268
+3,7,9~5,7,9
+2,4,98~2,5,98
+6,2,49~6,2,51
+6,5,184~8,5,184
+2,5,216~4,5,216
+7,8,124~9,8,124
+4,1,154~4,3,154
+0,7,206~0,7,208
+4,2,195~6,2,195
+3,3,99~3,5,99
+6,4,144~6,7,144
+9,3,96~9,6,96
+9,5,49~9,8,49
+0,9,107~2,9,107
+2,3,93~2,5,93
+6,1,14~9,1,14
+9,8,271~9,8,272
+4,5,172~4,8,172
+6,3,103~9,3,103
+3,4,110~3,4,110
+6,9,103~9,9,103
+3,5,284~5,5,284
+5,7,292~6,7,292
+9,5,91~9,7,91
+6,6,12~6,8,12
+4,3,228~6,3,228
+6,4,238~6,6,238
+4,3,233~6,3,233
+1,2,245~4,2,245
+9,8,101~9,9,101
+2,0,205~2,3,205
+0,4,184~3,4,184
+0,7,36~2,7,36
+2,5,111~2,8,111
+3,3,175~4,3,175
+5,9,84~7,9,84
+8,4,189~9,4,189
+1,4,118~2,4,118
+2,4,228~2,6,228
+4,9,78~6,9,78
+3,2,297~4,2,297
+3,4,227~3,6,227
+9,2,208~9,4,208
+8,5,189~8,7,189
+5,6,6~7,6,6
+3,0,291~3,3,291
+0,5,120~0,5,121
+6,6,150~6,7,150
+9,2,58~9,2,60
+5,0,84~5,3,84
+6,6,81~9,6,81
+4,5,215~4,7,215
+5,2,21~6,2,21
+6,2,61~6,4,61
+3,3,134~4,3,134
+1,3,105~1,6,105
+3,1,206~5,1,206
+9,6,133~9,8,133
+3,6,294~4,6,294
+2,0,31~3,0,31
+3,2,246~3,2,247
+9,4,47~9,4,49
+8,5,110~8,6,110
+6,8,198~9,8,198
+5,6,66~5,8,66
+8,2,1~8,4,1
+4,2,148~4,2,150
+0,1,202~0,2,202
+0,5,110~2,5,110
+5,6,174~7,6,174
+5,5,297~5,8,297
+3,4,218~3,7,218
+2,6,86~2,9,86
+9,1,105~9,3,105
+9,7,72~9,9,72
+2,3,284~4,3,284
+8,8,70~8,8,73
+5,1,43~5,4,43
+8,7,106~8,9,106
+4,1,159~6,1,159
+0,4,136~1,4,136
+7,2,173~7,4,173
+0,5,182~0,7,182
+9,5,203~9,8,203
+8,4,227~8,4,229
+8,4,257~8,4,258
+1,6,140~2,6,140
+1,9,113~3,9,113
+4,3,199~7,3,199
+4,3,158~8,3,158
+3,0,34~4,0,34
+2,1,80~5,1,80
+0,2,188~0,2,189
+8,7,154~8,9,154
+6,4,292~7,4,292
+6,2,137~8,2,137
+8,0,179~9,0,179
+2,5,232~2,6,232
+7,6,294~7,7,294
+3,4,132~4,4,132
+0,4,241~0,5,241
+4,2,52~4,4,52
+2,6,233~2,8,233
+3,3,245~3,5,245
+6,2,173~6,4,173
+5,1,106~6,1,106
+3,3,4~5,3,4
+1,4,153~3,4,153
+1,6,102~2,6,102
+5,0,159~5,0,159
+3,5,112~5,5,112
+4,1,71~4,2,71
+4,4,176~4,4,176
+7,4,290~7,6,290
+0,7,261~0,8,261
+7,8,4~9,8,4
+1,9,283~2,9,283
+4,9,62~6,9,62
+3,4,138~6,4,138
+6,6,251~6,9,251
+2,8,209~2,8,209
+0,2,221~1,2,221
+2,1,224~2,3,224
+4,2,60~4,2,63
+4,5,212~5,5,212
+5,9,155~8,9,155
+2,9,109~2,9,110
+8,6,204~8,8,204
+5,9,14~8,9,14
+3,7,27~5,7,27
+9,3,3~9,3,4
+6,0,105~6,3,105
+4,4,25~7,4,25
+9,3,190~9,5,190
+8,5,28~8,5,29
+9,8,96~9,8,98
+3,0,294~3,3,294
+0,2,185~0,4,185
+5,7,284~8,7,284
+5,7,11~5,9,11
+6,3,66~9,3,66
+7,0,181~9,0,181
+4,4,305~6,4,305
+5,4,219~5,8,219
+7,0,204~7,2,204
+4,8,62~7,8,62
+0,3,111~0,5,111
+3,9,56~6,9,56
+4,7,51~5,7,51
+5,4,135~5,7,135
+2,6,166~3,6,166
+1,0,277~1,3,277
+4,8,138~6,8,138
+1,4,225~1,7,225
+0,9,141~2,9,141
+0,4,203~0,7,203
+5,7,100~5,8,100
+9,5,135~9,7,135
+8,6,197~8,8,197
+4,3,177~6,3,177
+4,0,114~4,0,114
+2,0,174~2,2,174
+9,1,26~9,3,26
+1,5,25~1,5,26
+5,6,298~5,8,298
+3,4,169~3,4,170
+5,2,93~5,4,93
+2,0,103~2,2,103
+0,4,174~0,7,174
+2,4,103~4,4,103
+4,1,48~7,1,48
+6,8,184~8,8,184
+2,4,95~2,4,97
+4,5,12~4,7,12
+8,5,10~9,5,10
+2,9,201~5,9,201
+7,9,66~9,9,66
+7,7,297~7,9,297
+3,3,33~3,5,33
+0,6,39~3,6,39
+0,3,202~1,3,202
+7,6,83~7,8,83
+2,0,142~2,3,142
+1,1,101~5,1,101
+3,3,307~6,3,307
+6,3,259~6,4,259
+5,3,203~6,3,203
+4,8,188~6,8,188
+5,6,284~7,6,284
+4,9,91~6,9,91
+1,5,158~1,8,158
+2,3,278~5,3,278
+7,4,287~7,7,287
+0,0,39~2,0,39
+5,1,7~7,1,7
+9,0,108~9,3,108
+4,9,193~6,9,193
+0,2,187~0,5,187
+8,2,140~9,2,140
+3,2,96~3,2,99
+1,0,223~1,2,223
+8,7,3~9,7,3
+2,9,116~2,9,119
+2,7,224~5,7,224
+4,3,126~5,3,126
+0,8,87~2,8,87
+7,0,53~7,1,53
+3,1,71~3,4,71
+5,7,10~7,7,10
+6,6,262~7,6,262
+2,9,161~4,9,161
+7,3,18~7,5,18
+0,0,72~2,0,72
+4,2,310~4,5,310
+4,5,128~4,6,128
+4,1,64~6,1,64
+7,4,191~7,6,191
+1,9,72~3,9,72
+6,0,55~9,0,55
+7,7,253~9,7,253
+4,6,24~4,8,24
+8,6,282~8,7,282
+4,2,299~5,2,299
+1,6,117~1,9,117
+3,0,109~5,0,109
+6,5,86~9,5,86
+6,3,200~8,3,200
+1,4,271~1,7,271
+1,4,67~4,4,67
+3,0,73~3,2,73
+3,5,34~3,8,34
+6,2,20~9,2,20
+3,9,54~6,9,54
+5,6,136~5,8,136
+2,2,218~5,2,218
+5,1,262~8,1,262
+1,8,31~2,8,31
+5,5,171~5,7,171
+6,2,45~8,2,45
+3,2,244~5,2,244
+0,3,214~0,6,214
+5,6,138~5,6,139
+4,2,92~4,4,92
+1,7,28~3,7,28
+1,5,80~3,5,80
+6,4,308~6,4,308
+4,6,220~6,6,220
+3,6,190~3,7,190
+4,8,81~6,8,81
+4,6,137~5,6,137
+1,8,69~3,8,69
+5,4,66~5,5,66
+6,7,245~8,7,245
+2,5,131~3,5,131
+1,9,232~3,9,232
+6,4,4~6,6,4
+4,6,287~4,8,287
+5,8,231~5,8,232
+5,6,265~6,6,265
+2,4,83~2,6,83
+5,2,256~8,2,256
+1,2,159~1,4,159
+8,4,32~8,5,32
+4,5,99~4,7,99
+4,3,211~4,5,211
+5,7,74~5,9,74
+6,7,14~6,8,14
+7,2,42~7,3,42
+1,5,273~1,5,275
+3,6,172~3,6,176
+5,6,248~7,6,248
+7,0,180~9,0,180
+6,4,88~6,5,88
+2,0,93~5,0,93
+2,5,296~2,8,296
+5,3,40~5,5,40
+2,8,174~4,8,174
+4,6,134~6,6,134
+3,3,144~4,3,144
+0,4,239~0,7,239
+3,9,274~5,9,274
+6,2,312~6,2,315
+9,5,87~9,6,87
+6,2,166~6,2,168
+2,3,62~4,3,62
+3,2,287~3,4,287
+4,1,246~5,1,246
+2,3,207~2,6,207
+2,7,202~3,7,202
+1,4,250~4,4,250
+1,4,296~1,6,296
+2,9,255~5,9,255
+5,3,163~9,3,163
+2,1,31~2,2,31
+6,3,63~8,3,63
+1,2,31~1,4,31
+5,2,64~5,4,64
+6,3,40~9,3,40
+5,8,228~7,8,228
+2,2,145~2,2,147
+2,5,242~3,5,242
+5,5,300~5,6,300
+5,6,226~5,8,226
+0,2,138~0,4,138
+3,4,60~7,4,60
+4,5,260~4,5,260
+0,2,240~0,4,240
+7,7,61~7,9,61
+5,7,118~6,7,118
+2,5,272~2,7,272
+9,1,250~9,4,250
+7,4,98~7,6,98
+3,7,71~6,7,71
+6,2,292~8,2,292
+0,4,253~0,8,253
+1,7,33~3,7,33
+0,8,101~3,8,101
+6,5,2~6,8,2
+2,3,24~2,5,24
+3,7,193~3,7,194
+3,0,196~3,3,196
+2,4,223~5,4,223
+5,1,213~5,3,213
+1,3,107~2,3,107
+4,9,159~6,9,159
+1,2,70~1,2,70
+4,6,104~7,6,104
+3,1,168~3,3,168
+4,7,229~8,7,229
+5,5,223~5,5,224
+8,0,224~8,2,224
+2,8,203~5,8,203
+3,7,67~3,9,67
+7,1,140~7,3,140
+7,6,266~7,9,266
+1,7,29~1,7,32
+1,7,70~3,7,70
+2,3,174~2,6,174
+5,4,237~7,4,237
+0,1,280~2,1,280
+4,5,306~4,7,306
+0,4,134~3,4,134
+2,9,282~4,9,282
+8,6,205~8,9,205
+4,1,61~5,1,61
+2,4,253~3,4,253
+5,4,155~5,6,155
+3,1,75~3,4,75
+7,0,155~7,0,156
+9,6,83~9,7,83
+6,5,280~8,5,280
+6,2,309~6,3,309
+5,0,235~7,0,235
+5,5,143~7,5,143
+1,5,22~3,5,22
+6,4,208~6,4,210
+3,4,234~3,6,234
+2,1,86~2,3,86
+1,5,294~3,5,294
+4,6,228~7,6,228
+0,4,204~0,6,204
+2,7,123~2,9,123
+7,4,295~7,5,295
+1,3,155~1,6,155
+1,4,49~4,4,49
+7,2,239~9,2,239
+2,4,302~4,4,302
+4,4,57~4,7,57
+5,5,192~5,7,192
+9,2,97~9,3,97
+0,7,96~2,7,96
+2,6,21~4,6,21
+1,5,169~1,6,169
+7,9,67~8,9,67
+3,1,4~4,1,4
+5,5,116~5,8,116
+0,6,102~0,9,102
+0,2,279~1,2,279
+2,6,163~2,8,163
+7,5,123~7,8,123
+0,0,226~0,2,226
+4,7,144~5,7,144
+3,0,2~3,0,5
+6,0,109~6,2,109
+2,5,128~2,6,128
+5,3,106~5,3,108
+6,3,149~6,5,149
+0,0,154~0,2,154
+6,2,226~6,4,226
+2,9,90~5,9,90
+5,7,280~6,7,280
+0,8,122~3,8,122
+5,2,101~5,5,101
+5,4,158~5,4,160
+0,6,5~2,6,5
+9,4,46~9,5,46
+8,1,16~8,1,18
+0,9,60~2,9,60
+4,2,200~4,3,200
+1,2,94~3,2,94
+4,0,237~6,0,237
+0,6,258~0,7,258
+5,2,14~5,4,14
+2,3,209~4,3,209
+2,8,207~3,8,207
+1,7,12~2,7,12
+8,1,220~8,3,220
+4,9,196~5,9,196
+0,8,135~0,9,135
+8,6,33~8,7,33
+7,4,29~7,6,29
+9,0,1~9,0,3
+3,1,176~5,1,176
+6,2,237~8,2,237
+6,4,112~6,5,112
+5,2,22~7,2,22
+5,1,242~8,1,242
+0,5,49~0,7,49
+4,7,268~7,7,268
+0,8,28~2,8,28
+5,2,216~5,5,216
+0,3,140~0,4,140
+4,4,288~6,4,288
+4,3,180~7,3,180
+3,1,308~3,3,308
+3,3,171~3,3,173
+1,3,160~3,3,160
+7,6,65~7,8,65
+7,5,181~7,9,181
+3,0,85~5,0,85
+7,5,279~7,7,279
+5,3,274~5,5,274
+0,5,259~0,7,259
+5,7,290~7,7,290
+2,5,192~2,8,192
+5,2,310~5,2,312
+8,1,221~8,2,221
+2,0,68~2,2,68
+1,9,57~3,9,57
+3,9,156~6,9,156
+8,2,280~8,4,280
+8,1,2~8,1,3
+7,3,296~7,5,296
+0,4,179~3,4,179
+7,6,292~8,6,292
+0,5,180~3,5,180
+5,5,110~5,7,110
+3,7,58~5,7,58
+5,4,76~5,7,76
+4,4,50~4,6,50
+1,9,131~3,9,131
+5,9,70~6,9,70
+8,4,94~8,5,94
+5,0,219~5,2,219
+8,3,176~9,3,176
+6,3,131~8,3,131
+3,3,240~4,3,240
+4,2,79~7,2,79
+8,5,188~8,7,188
+0,8,123~0,8,125
+2,8,290~4,8,290
+7,4,209~7,7,209
+0,1,147~0,3,147
+3,4,20~5,4,20
+0,5,236~1,5,236
+9,6,275~9,8,275
+7,5,186~7,6,186
+4,1,96~5,1,96
+6,5,90~6,7,90
+1,6,53~4,6,53
+8,2,204~8,4,204
+5,1,98~5,1,100
+4,2,121~4,5,121
+5,2,1~7,2,1
+0,8,62~0,9,62
+6,2,200~7,2,200
+0,1,256~0,4,256
+8,7,193~8,9,193
+0,4,278~1,4,278
+6,3,117~8,3,117
+5,4,49~5,7,49
+4,4,106~5,4,106
+6,4,243~8,4,243
+5,3,290~5,5,290
+7,5,157~7,7,157
+2,4,168~5,4,168
+4,9,60~6,9,60
+3,3,65~3,4,65
+8,5,30~8,7,30
+1,5,167~4,5,167
+2,5,57~2,7,57
+0,9,234~1,9,234
+0,3,193~2,3,193
+0,3,94~2,3,94
+7,7,210~7,9,210
+3,4,69~4,4,69
+8,2,218~8,5,218
+1,2,174~1,2,176
+1,2,114~1,3,114
+0,6,110~0,8,110
+2,1,149~4,1,149
+7,4,139~7,4,141
+0,1,257~0,3,257
+7,4,2~7,6,2
+9,1,8~9,5,8
+0,5,29~1,5,29
+0,6,231~3,6,231
+9,3,213~9,4,213
+7,0,50~7,2,50
+1,3,181~1,6,181
+3,9,195~4,9,195
+7,8,17~9,8,17
+1,1,104~3,1,104
+6,7,137~8,7,137
+4,1,51~4,1,51
+1,1,107~3,1,107
+8,7,200~9,7,200
+6,4,223~8,4,223
+2,8,133~2,9,133
+5,0,92~7,0,92
+9,3,171~9,5,171
+3,8,275~5,8,275
+0,5,119~1,5,119
+0,4,1~0,4,2
+5,0,108~8,0,108
+1,0,117~1,0,120
+5,0,147~7,0,147
+3,0,221~3,2,221
+5,4,111~8,4,111
+4,1,201~4,4,201
+4,3,230~6,3,230
+2,0,196~2,3,196
+5,6,141~5,8,141
+3,0,285~4,0,285
+5,3,161~6,3,161
+8,6,107~8,6,109
+4,3,174~6,3,174
+2,4,21~2,5,21
+8,3,225~8,4,225
+8,3,221~9,3,221
+8,7,68~8,8,68
+1,1,39~1,1,39
+0,7,16~1,7,16
+4,6,281~5,6,281
+6,6,106~8,6,106
+8,1,209~8,4,209
+3,5,97~5,5,97
+5,1,85~8,1,85
+5,2,203~9,2,203
+9,3,214~9,6,214
+4,2,239~4,4,239
+2,3,175~2,3,177
+2,4,58~2,7,58
+0,1,68~0,2,68
+4,1,185~6,1,185
+0,2,110~0,3,110
+4,2,181~6,2,181
+8,5,221~9,5,221
+4,9,87~6,9,87
+5,3,114~7,3,114
+2,1,54~4,1,54
+5,3,164~5,3,165
+4,2,287~4,5,287
+3,5,120~3,5,122
+3,0,37~3,0,37
+6,4,56~6,7,56
+4,0,113~7,0,113
+0,4,197~0,4,198
+1,2,196~1,5,196
+5,2,309~5,3,309
+7,8,67~8,8,67
+4,1,156~6,1,156
+4,9,81~7,9,81
+6,5,151~6,6,151
+3,1,92~3,4,92
+9,4,88~9,6,88
+4,3,17~6,3,17
+3,0,1~4,0,1
+7,2,177~7,2,179
+9,2,23~9,5,23
+0,2,211~0,4,211
+2,2,5~2,3,5
+8,5,35~8,6,35
+8,6,34~8,8,34
+1,7,102~1,9,102
+7,2,56~8,2,56
+4,0,111~6,0,111
+8,5,122~8,5,124
+1,9,276~3,9,276
+8,5,2~8,8,2
+8,4,135~8,4,138
+8,9,127~9,9,127
+7,1,144~9,1,144
+6,4,200~9,4,200
+4,1,3~4,3,3
+0,8,121~4,8,121
+2,8,70~4,8,70
+0,9,284~3,9,284
+0,1,89~2,1,89
+5,2,140~5,5,140
+5,9,268~7,9,268
+1,5,177~1,8,177
+4,2,229~5,2,229
+3,0,225~4,0,225
+3,2,63~3,4,63
+1,2,219~4,2,219
+3,9,42~3,9,45
+3,1,134~5,1,134
+6,9,157~6,9,158
+2,4,161~2,6,161
+3,7,131~4,7,131
+7,1,23~7,2,23
+0,3,115~0,6,115
+0,1,156~3,1,156
+4,8,205~4,8,208
+1,6,132~1,9,132
+0,5,198~0,5,200
+0,5,17~0,8,17
+6,5,293~8,5,293
+0,3,139~0,4,139
+5,2,258~7,2,258
+1,6,284~4,6,284
+6,0,65~9,0,65
+7,4,220~8,4,220
+0,3,28~2,3,28
+7,6,140~7,8,140
+5,1,88~7,1,88
+5,2,96~7,2,96
+1,7,270~5,7,270
+0,7,43~0,9,43
+7,1,55~9,1,55
+2,1,209~4,1,209
+2,5,196~4,5,196
+4,1,160~6,1,160
+4,2,161~4,3,161
+0,0,208~2,0,208
+0,6,51~0,6,51
+3,3,257~6,3,257
+2,6,125~2,7,125
+6,6,136~6,9,136
+3,5,220~6,5,220
+9,1,107~9,2,107
+6,1,143~8,1,143
+8,5,202~8,6,202
+9,0,210~9,2,210
+3,4,114~4,4,114
+2,2,27~2,4,27
+6,4,84~6,7,84
+3,3,141~5,3,141
+5,3,277~8,3,277
+5,0,220~6,0,220
+2,4,66~2,7,66
+2,3,83~4,3,83
+0,2,200~0,4,200
+1,4,147~3,4,147
+4,3,236~5,3,236
+1,6,113~1,6,114
+5,8,222~8,8,222
+1,8,238~3,8,238
+1,1,212~2,1,212
+3,0,75~5,0,75
+7,5,115~9,5,115
+6,0,114~6,2,114
+3,1,256~3,4,256
+4,7,225~5,7,225
+5,4,152~8,4,152
+6,4,87~7,4,87
+4,2,173~4,5,173
+9,2,132~9,4,132
+5,2,253~5,4,253
+0,7,194~2,7,194
+7,3,95~7,5,95
+6,8,272~8,8,272
+5,4,16~7,4,16
+2,4,240~2,6,240
+1,6,15~1,8,15
+8,4,153~8,5,153
+0,7,34~1,7,34
+4,3,212~6,3,212
+1,5,278~1,7,278
+5,4,145~6,4,145
+8,3,259~8,3,262
+6,0,47~6,2,47
+1,2,139~1,5,139
+2,2,67~3,2,67
+5,7,83~5,9,83
+2,9,287~5,9,287
+1,0,226~1,0,229
+3,1,6~6,1,6
+4,1,70~7,1,70
+2,7,8~5,7,8
+1,3,163~1,6,163
+4,0,180~6,0,180
+1,5,262~4,5,262
+5,9,146~7,9,146
+4,4,118~5,4,118
+7,7,183~7,7,184
+4,0,147~4,2,147
+6,9,92~8,9,92
+2,3,25~2,4,25
+6,0,178~6,2,178
+8,0,173~8,3,173
+2,3,263~2,6,263
+1,6,143~4,6,143
+3,1,151~3,1,152
+2,0,34~2,0,38
+4,6,87~6,6,87
+4,3,147~6,3,147
+4,1,110~7,1,110
+6,5,59~8,5,59
+3,4,235~3,4,238
+0,4,208~3,4,208
+8,2,133~8,4,133
+6,4,207~9,4,207
+3,9,16~5,9,16
+2,2,95~2,2,95
+0,9,42~2,9,42
+4,4,110~4,4,112
diff --git a/2023/src/bin/day_22.rs b/2023/src/bin/day_22.rs
index b3a610b..3619b83 100644
--- a/2023/src/bin/day_22.rs
+++ b/2023/src/bin/day_22.rs
@@ -1,19 +1,49 @@
-use nom::IResult;
+use nalgebra::Point3;
+use nom::{
+ bytes::complete::tag,
+ character::complete::{line_ending, u32},
+ combinator::map,
+ multi::separated_list1,
+ sequence::{separated_pair, tuple},
+ IResult,
+};
use std::fs;
fn main() -> Result<(), Box<dyn std::error::Error>> {
- let input = fs::read_to_string("inputs/day_2.txt")?;
- let parsed = Example::parser(&input).unwrap().1;
+ let input = fs::read_to_string("inputs/day_22.txt")?;
+ let parsed = BrickPile::parser(&input).unwrap().1;
dbg!(&parsed);
Ok(())
}
#[derive(Debug)]
-struct Example;
+struct BrickPile(Vec<Brick>);
-impl Example {
- fn parser(_input: &str) -> IResult<&str, Self> {
- todo!()
+#[derive(Debug)]
+struct Brick {
+ a: Point3<u32>,
+ b: Point3<u32>,
+}
+
+impl BrickPile {
+ fn parser(input: &str) -> IResult<&str, Self> {
+ map(separated_list1(line_ending, Brick::parser), BrickPile)(input)
+ }
+}
+
+impl Brick {
+ fn parser(input: &str) -> IResult<&str, Self> {
+ map(
+ separated_pair(point_parser, tag("~"), point_parser),
+ |(a, b)| Brick { a, b },
+ )(input)
}
}
+
+fn point_parser(input: &str) -> IResult<&str, Point3<u32>> {
+ map(
+ tuple((u32, tag(","), u32, tag(","), u32)),
+ |(x, _, y, _, z)| Point3::new(x, y, z),
+ )(input)
+}