Add 2022 day 5
This commit is contained in:
parent
59a074db50
commit
009bd54c79
|
@ -0,0 +1,14 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "common"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "day5"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"common",
|
||||||
|
]
|
|
@ -0,0 +1,9 @@
|
||||||
|
[package]
|
||||||
|
name = "day5"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
common = { path = "../common" }
|
|
@ -0,0 +1,501 @@
|
||||||
|
move 1 from 5 to 6
|
||||||
|
move 5 from 6 to 7
|
||||||
|
move 10 from 7 to 3
|
||||||
|
move 4 from 8 to 4
|
||||||
|
move 2 from 5 to 4
|
||||||
|
move 4 from 3 to 6
|
||||||
|
move 6 from 2 to 4
|
||||||
|
move 8 from 6 to 9
|
||||||
|
move 5 from 9 to 2
|
||||||
|
move 7 from 2 to 7
|
||||||
|
move 2 from 1 to 4
|
||||||
|
move 3 from 3 to 8
|
||||||
|
move 1 from 5 to 9
|
||||||
|
move 1 from 3 to 8
|
||||||
|
move 1 from 1 to 2
|
||||||
|
move 11 from 4 to 6
|
||||||
|
move 2 from 5 to 6
|
||||||
|
move 10 from 9 to 1
|
||||||
|
move 4 from 8 to 3
|
||||||
|
move 7 from 7 to 1
|
||||||
|
move 9 from 1 to 2
|
||||||
|
move 1 from 6 to 5
|
||||||
|
move 1 from 5 to 9
|
||||||
|
move 5 from 3 to 8
|
||||||
|
move 2 from 9 to 1
|
||||||
|
move 5 from 3 to 9
|
||||||
|
move 3 from 6 to 8
|
||||||
|
move 5 from 9 to 6
|
||||||
|
move 6 from 6 to 3
|
||||||
|
move 3 from 3 to 2
|
||||||
|
move 1 from 9 to 8
|
||||||
|
move 13 from 2 to 3
|
||||||
|
move 3 from 8 to 1
|
||||||
|
move 11 from 1 to 4
|
||||||
|
move 3 from 4 to 1
|
||||||
|
move 2 from 6 to 5
|
||||||
|
move 4 from 6 to 8
|
||||||
|
move 17 from 3 to 9
|
||||||
|
move 1 from 1 to 8
|
||||||
|
move 1 from 6 to 5
|
||||||
|
move 1 from 3 to 7
|
||||||
|
move 1 from 7 to 4
|
||||||
|
move 3 from 4 to 1
|
||||||
|
move 1 from 3 to 8
|
||||||
|
move 4 from 8 to 1
|
||||||
|
move 3 from 5 to 9
|
||||||
|
move 1 from 6 to 4
|
||||||
|
move 4 from 4 to 8
|
||||||
|
move 2 from 8 to 4
|
||||||
|
move 2 from 1 to 6
|
||||||
|
move 4 from 8 to 6
|
||||||
|
move 1 from 8 to 3
|
||||||
|
move 6 from 6 to 3
|
||||||
|
move 6 from 3 to 9
|
||||||
|
move 6 from 1 to 4
|
||||||
|
move 5 from 8 to 4
|
||||||
|
move 1 from 3 to 6
|
||||||
|
move 3 from 1 to 7
|
||||||
|
move 1 from 6 to 7
|
||||||
|
move 4 from 4 to 5
|
||||||
|
move 24 from 9 to 5
|
||||||
|
move 2 from 9 to 1
|
||||||
|
move 27 from 5 to 7
|
||||||
|
move 13 from 7 to 2
|
||||||
|
move 1 from 5 to 9
|
||||||
|
move 7 from 2 to 7
|
||||||
|
move 1 from 9 to 8
|
||||||
|
move 5 from 2 to 8
|
||||||
|
move 1 from 2 to 5
|
||||||
|
move 1 from 5 to 7
|
||||||
|
move 21 from 4 to 1
|
||||||
|
move 1 from 4 to 6
|
||||||
|
move 1 from 6 to 5
|
||||||
|
move 22 from 7 to 5
|
||||||
|
move 2 from 7 to 8
|
||||||
|
move 7 from 5 to 4
|
||||||
|
move 1 from 4 to 5
|
||||||
|
move 2 from 7 to 9
|
||||||
|
move 5 from 5 to 2
|
||||||
|
move 5 from 4 to 2
|
||||||
|
move 3 from 5 to 1
|
||||||
|
move 7 from 8 to 7
|
||||||
|
move 1 from 4 to 1
|
||||||
|
move 23 from 1 to 8
|
||||||
|
move 2 from 9 to 4
|
||||||
|
move 11 from 8 to 3
|
||||||
|
move 3 from 1 to 3
|
||||||
|
move 1 from 4 to 2
|
||||||
|
move 12 from 3 to 2
|
||||||
|
move 7 from 7 to 3
|
||||||
|
move 3 from 2 to 1
|
||||||
|
move 1 from 4 to 9
|
||||||
|
move 1 from 1 to 3
|
||||||
|
move 9 from 8 to 6
|
||||||
|
move 2 from 5 to 4
|
||||||
|
move 3 from 1 to 7
|
||||||
|
move 3 from 2 to 4
|
||||||
|
move 7 from 2 to 3
|
||||||
|
move 9 from 3 to 4
|
||||||
|
move 7 from 5 to 2
|
||||||
|
move 2 from 7 to 2
|
||||||
|
move 1 from 7 to 2
|
||||||
|
move 13 from 4 to 6
|
||||||
|
move 1 from 9 to 8
|
||||||
|
move 2 from 8 to 2
|
||||||
|
move 12 from 2 to 1
|
||||||
|
move 3 from 3 to 1
|
||||||
|
move 1 from 8 to 1
|
||||||
|
move 5 from 3 to 7
|
||||||
|
move 3 from 2 to 8
|
||||||
|
move 7 from 2 to 5
|
||||||
|
move 3 from 8 to 3
|
||||||
|
move 1 from 4 to 8
|
||||||
|
move 22 from 6 to 4
|
||||||
|
move 1 from 3 to 6
|
||||||
|
move 3 from 5 to 8
|
||||||
|
move 4 from 5 to 8
|
||||||
|
move 1 from 3 to 9
|
||||||
|
move 8 from 4 to 2
|
||||||
|
move 8 from 8 to 3
|
||||||
|
move 1 from 6 to 3
|
||||||
|
move 4 from 2 to 6
|
||||||
|
move 1 from 9 to 4
|
||||||
|
move 5 from 3 to 9
|
||||||
|
move 2 from 8 to 1
|
||||||
|
move 3 from 2 to 1
|
||||||
|
move 10 from 4 to 8
|
||||||
|
move 4 from 7 to 6
|
||||||
|
move 10 from 1 to 3
|
||||||
|
move 9 from 8 to 2
|
||||||
|
move 1 from 7 to 1
|
||||||
|
move 15 from 3 to 1
|
||||||
|
move 1 from 8 to 9
|
||||||
|
move 4 from 4 to 1
|
||||||
|
move 17 from 1 to 3
|
||||||
|
move 3 from 2 to 3
|
||||||
|
move 3 from 6 to 8
|
||||||
|
move 5 from 9 to 7
|
||||||
|
move 11 from 1 to 8
|
||||||
|
move 4 from 7 to 8
|
||||||
|
move 6 from 2 to 5
|
||||||
|
move 2 from 1 to 4
|
||||||
|
move 4 from 6 to 8
|
||||||
|
move 16 from 8 to 6
|
||||||
|
move 2 from 6 to 1
|
||||||
|
move 1 from 9 to 5
|
||||||
|
move 1 from 7 to 5
|
||||||
|
move 2 from 5 to 6
|
||||||
|
move 5 from 6 to 3
|
||||||
|
move 2 from 8 to 5
|
||||||
|
move 1 from 2 to 1
|
||||||
|
move 10 from 6 to 3
|
||||||
|
move 6 from 5 to 9
|
||||||
|
move 2 from 1 to 2
|
||||||
|
move 2 from 4 to 2
|
||||||
|
move 1 from 2 to 4
|
||||||
|
move 5 from 9 to 2
|
||||||
|
move 1 from 4 to 3
|
||||||
|
move 1 from 9 to 7
|
||||||
|
move 1 from 6 to 1
|
||||||
|
move 1 from 1 to 7
|
||||||
|
move 2 from 7 to 5
|
||||||
|
move 7 from 2 to 5
|
||||||
|
move 6 from 5 to 1
|
||||||
|
move 1 from 2 to 3
|
||||||
|
move 1 from 4 to 1
|
||||||
|
move 2 from 8 to 9
|
||||||
|
move 8 from 1 to 3
|
||||||
|
move 2 from 5 to 3
|
||||||
|
move 29 from 3 to 9
|
||||||
|
move 5 from 3 to 8
|
||||||
|
move 6 from 8 to 5
|
||||||
|
move 1 from 6 to 5
|
||||||
|
move 6 from 3 to 2
|
||||||
|
move 2 from 2 to 4
|
||||||
|
move 1 from 1 to 7
|
||||||
|
move 18 from 9 to 6
|
||||||
|
move 2 from 2 to 9
|
||||||
|
move 2 from 2 to 8
|
||||||
|
move 13 from 6 to 8
|
||||||
|
move 1 from 7 to 4
|
||||||
|
move 3 from 5 to 6
|
||||||
|
move 1 from 5 to 7
|
||||||
|
move 1 from 7 to 4
|
||||||
|
move 14 from 9 to 3
|
||||||
|
move 3 from 4 to 5
|
||||||
|
move 1 from 9 to 7
|
||||||
|
move 14 from 3 to 2
|
||||||
|
move 1 from 7 to 3
|
||||||
|
move 4 from 2 to 5
|
||||||
|
move 16 from 8 to 6
|
||||||
|
move 11 from 6 to 9
|
||||||
|
move 13 from 6 to 4
|
||||||
|
move 5 from 5 to 2
|
||||||
|
move 12 from 2 to 4
|
||||||
|
move 19 from 4 to 3
|
||||||
|
move 7 from 4 to 5
|
||||||
|
move 14 from 5 to 2
|
||||||
|
move 2 from 3 to 6
|
||||||
|
move 3 from 9 to 5
|
||||||
|
move 2 from 6 to 2
|
||||||
|
move 1 from 5 to 2
|
||||||
|
move 3 from 5 to 4
|
||||||
|
move 3 from 4 to 1
|
||||||
|
move 7 from 9 to 6
|
||||||
|
move 4 from 6 to 1
|
||||||
|
move 1 from 1 to 8
|
||||||
|
move 3 from 6 to 9
|
||||||
|
move 1 from 8 to 7
|
||||||
|
move 1 from 9 to 6
|
||||||
|
move 4 from 1 to 2
|
||||||
|
move 1 from 7 to 2
|
||||||
|
move 2 from 9 to 8
|
||||||
|
move 10 from 2 to 9
|
||||||
|
move 2 from 2 to 9
|
||||||
|
move 11 from 3 to 7
|
||||||
|
move 1 from 8 to 9
|
||||||
|
move 2 from 3 to 7
|
||||||
|
move 1 from 1 to 7
|
||||||
|
move 10 from 2 to 4
|
||||||
|
move 3 from 4 to 1
|
||||||
|
move 4 from 1 to 8
|
||||||
|
move 1 from 6 to 5
|
||||||
|
move 6 from 7 to 9
|
||||||
|
move 3 from 9 to 1
|
||||||
|
move 1 from 5 to 1
|
||||||
|
move 4 from 4 to 2
|
||||||
|
move 5 from 2 to 1
|
||||||
|
move 1 from 2 to 7
|
||||||
|
move 2 from 7 to 6
|
||||||
|
move 1 from 2 to 1
|
||||||
|
move 2 from 9 to 1
|
||||||
|
move 3 from 4 to 7
|
||||||
|
move 1 from 3 to 7
|
||||||
|
move 2 from 8 to 3
|
||||||
|
move 2 from 6 to 5
|
||||||
|
move 2 from 5 to 8
|
||||||
|
move 10 from 7 to 2
|
||||||
|
move 6 from 9 to 1
|
||||||
|
move 1 from 7 to 3
|
||||||
|
move 2 from 8 to 9
|
||||||
|
move 7 from 3 to 7
|
||||||
|
move 7 from 3 to 9
|
||||||
|
move 1 from 8 to 9
|
||||||
|
move 6 from 2 to 8
|
||||||
|
move 13 from 9 to 1
|
||||||
|
move 6 from 9 to 8
|
||||||
|
move 2 from 2 to 7
|
||||||
|
move 3 from 7 to 1
|
||||||
|
move 1 from 8 to 1
|
||||||
|
move 1 from 1 to 6
|
||||||
|
move 16 from 1 to 4
|
||||||
|
move 2 from 7 to 5
|
||||||
|
move 12 from 4 to 9
|
||||||
|
move 4 from 8 to 6
|
||||||
|
move 2 from 5 to 1
|
||||||
|
move 8 from 8 to 4
|
||||||
|
move 2 from 4 to 5
|
||||||
|
move 1 from 8 to 6
|
||||||
|
move 4 from 6 to 8
|
||||||
|
move 19 from 1 to 9
|
||||||
|
move 3 from 8 to 5
|
||||||
|
move 1 from 6 to 9
|
||||||
|
move 2 from 2 to 1
|
||||||
|
move 10 from 4 to 9
|
||||||
|
move 1 from 1 to 2
|
||||||
|
move 2 from 1 to 5
|
||||||
|
move 4 from 7 to 9
|
||||||
|
move 1 from 8 to 2
|
||||||
|
move 1 from 2 to 6
|
||||||
|
move 7 from 5 to 4
|
||||||
|
move 11 from 9 to 8
|
||||||
|
move 1 from 4 to 3
|
||||||
|
move 10 from 8 to 1
|
||||||
|
move 1 from 2 to 3
|
||||||
|
move 29 from 9 to 3
|
||||||
|
move 2 from 6 to 5
|
||||||
|
move 1 from 5 to 3
|
||||||
|
move 5 from 9 to 3
|
||||||
|
move 1 from 8 to 9
|
||||||
|
move 1 from 9 to 3
|
||||||
|
move 6 from 4 to 6
|
||||||
|
move 1 from 5 to 1
|
||||||
|
move 1 from 6 to 3
|
||||||
|
move 2 from 1 to 5
|
||||||
|
move 1 from 9 to 5
|
||||||
|
move 37 from 3 to 2
|
||||||
|
move 3 from 6 to 2
|
||||||
|
move 1 from 6 to 2
|
||||||
|
move 1 from 6 to 4
|
||||||
|
move 3 from 1 to 3
|
||||||
|
move 2 from 1 to 6
|
||||||
|
move 35 from 2 to 1
|
||||||
|
move 1 from 6 to 8
|
||||||
|
move 5 from 1 to 8
|
||||||
|
move 7 from 1 to 6
|
||||||
|
move 5 from 3 to 7
|
||||||
|
move 1 from 8 to 7
|
||||||
|
move 3 from 7 to 5
|
||||||
|
move 4 from 2 to 9
|
||||||
|
move 1 from 2 to 1
|
||||||
|
move 1 from 4 to 3
|
||||||
|
move 3 from 7 to 1
|
||||||
|
move 1 from 3 to 6
|
||||||
|
move 1 from 1 to 9
|
||||||
|
move 5 from 9 to 2
|
||||||
|
move 18 from 1 to 3
|
||||||
|
move 6 from 1 to 8
|
||||||
|
move 6 from 3 to 7
|
||||||
|
move 4 from 8 to 6
|
||||||
|
move 4 from 6 to 7
|
||||||
|
move 9 from 7 to 8
|
||||||
|
move 3 from 2 to 7
|
||||||
|
move 4 from 6 to 1
|
||||||
|
move 3 from 5 to 3
|
||||||
|
move 3 from 2 to 5
|
||||||
|
move 3 from 6 to 1
|
||||||
|
move 4 from 7 to 4
|
||||||
|
move 6 from 5 to 9
|
||||||
|
move 3 from 1 to 9
|
||||||
|
move 1 from 6 to 1
|
||||||
|
move 15 from 8 to 2
|
||||||
|
move 1 from 8 to 5
|
||||||
|
move 3 from 4 to 8
|
||||||
|
move 1 from 5 to 1
|
||||||
|
move 1 from 6 to 5
|
||||||
|
move 11 from 3 to 9
|
||||||
|
move 12 from 2 to 3
|
||||||
|
move 3 from 8 to 1
|
||||||
|
move 15 from 1 to 2
|
||||||
|
move 8 from 9 to 4
|
||||||
|
move 8 from 4 to 9
|
||||||
|
move 4 from 2 to 5
|
||||||
|
move 1 from 4 to 6
|
||||||
|
move 1 from 2 to 8
|
||||||
|
move 1 from 6 to 7
|
||||||
|
move 4 from 3 to 1
|
||||||
|
move 1 from 8 to 5
|
||||||
|
move 5 from 3 to 9
|
||||||
|
move 14 from 9 to 2
|
||||||
|
move 1 from 7 to 4
|
||||||
|
move 4 from 1 to 3
|
||||||
|
move 1 from 4 to 7
|
||||||
|
move 8 from 3 to 7
|
||||||
|
move 8 from 7 to 5
|
||||||
|
move 1 from 7 to 9
|
||||||
|
move 3 from 3 to 2
|
||||||
|
move 7 from 9 to 8
|
||||||
|
move 1 from 9 to 5
|
||||||
|
move 2 from 8 to 5
|
||||||
|
move 7 from 5 to 4
|
||||||
|
move 4 from 9 to 2
|
||||||
|
move 6 from 4 to 3
|
||||||
|
move 18 from 2 to 5
|
||||||
|
move 1 from 4 to 7
|
||||||
|
move 15 from 5 to 4
|
||||||
|
move 1 from 4 to 6
|
||||||
|
move 2 from 2 to 7
|
||||||
|
move 3 from 8 to 5
|
||||||
|
move 1 from 7 to 3
|
||||||
|
move 8 from 2 to 6
|
||||||
|
move 4 from 2 to 3
|
||||||
|
move 1 from 7 to 5
|
||||||
|
move 3 from 4 to 6
|
||||||
|
move 5 from 6 to 9
|
||||||
|
move 8 from 5 to 6
|
||||||
|
move 2 from 4 to 3
|
||||||
|
move 7 from 4 to 2
|
||||||
|
move 2 from 8 to 5
|
||||||
|
move 7 from 5 to 6
|
||||||
|
move 3 from 5 to 8
|
||||||
|
move 1 from 8 to 9
|
||||||
|
move 13 from 3 to 8
|
||||||
|
move 2 from 2 to 7
|
||||||
|
move 9 from 8 to 9
|
||||||
|
move 6 from 8 to 5
|
||||||
|
move 5 from 5 to 2
|
||||||
|
move 2 from 7 to 8
|
||||||
|
move 9 from 2 to 5
|
||||||
|
move 1 from 7 to 5
|
||||||
|
move 1 from 5 to 7
|
||||||
|
move 21 from 6 to 2
|
||||||
|
move 1 from 7 to 8
|
||||||
|
move 3 from 8 to 9
|
||||||
|
move 1 from 4 to 2
|
||||||
|
move 23 from 2 to 7
|
||||||
|
move 8 from 9 to 8
|
||||||
|
move 20 from 7 to 4
|
||||||
|
move 3 from 7 to 2
|
||||||
|
move 1 from 2 to 7
|
||||||
|
move 1 from 6 to 7
|
||||||
|
move 3 from 5 to 4
|
||||||
|
move 8 from 5 to 9
|
||||||
|
move 2 from 7 to 1
|
||||||
|
move 1 from 8 to 7
|
||||||
|
move 4 from 2 to 4
|
||||||
|
move 2 from 8 to 7
|
||||||
|
move 2 from 8 to 2
|
||||||
|
move 1 from 7 to 6
|
||||||
|
move 3 from 9 to 7
|
||||||
|
move 2 from 2 to 7
|
||||||
|
move 5 from 7 to 1
|
||||||
|
move 8 from 9 to 6
|
||||||
|
move 15 from 4 to 3
|
||||||
|
move 4 from 4 to 7
|
||||||
|
move 6 from 1 to 4
|
||||||
|
move 11 from 3 to 4
|
||||||
|
move 8 from 6 to 1
|
||||||
|
move 24 from 4 to 7
|
||||||
|
move 6 from 1 to 8
|
||||||
|
move 27 from 7 to 3
|
||||||
|
move 2 from 7 to 8
|
||||||
|
move 5 from 8 to 3
|
||||||
|
move 4 from 8 to 4
|
||||||
|
move 1 from 8 to 6
|
||||||
|
move 1 from 6 to 9
|
||||||
|
move 1 from 6 to 5
|
||||||
|
move 2 from 4 to 2
|
||||||
|
move 1 from 8 to 1
|
||||||
|
move 1 from 5 to 2
|
||||||
|
move 4 from 1 to 6
|
||||||
|
move 1 from 7 to 5
|
||||||
|
move 1 from 5 to 8
|
||||||
|
move 1 from 8 to 7
|
||||||
|
move 1 from 7 to 8
|
||||||
|
move 1 from 8 to 1
|
||||||
|
move 1 from 2 to 3
|
||||||
|
move 2 from 4 to 8
|
||||||
|
move 7 from 9 to 6
|
||||||
|
move 2 from 8 to 1
|
||||||
|
move 3 from 3 to 8
|
||||||
|
move 3 from 1 to 8
|
||||||
|
move 2 from 2 to 3
|
||||||
|
move 1 from 4 to 1
|
||||||
|
move 1 from 1 to 8
|
||||||
|
move 5 from 8 to 3
|
||||||
|
move 8 from 6 to 2
|
||||||
|
move 1 from 9 to 4
|
||||||
|
move 2 from 4 to 8
|
||||||
|
move 2 from 8 to 3
|
||||||
|
move 2 from 6 to 2
|
||||||
|
move 33 from 3 to 2
|
||||||
|
move 2 from 8 to 7
|
||||||
|
move 1 from 6 to 1
|
||||||
|
move 1 from 1 to 7
|
||||||
|
move 2 from 3 to 8
|
||||||
|
move 2 from 8 to 4
|
||||||
|
move 1 from 4 to 8
|
||||||
|
move 2 from 7 to 2
|
||||||
|
move 2 from 3 to 7
|
||||||
|
move 12 from 2 to 1
|
||||||
|
move 1 from 8 to 4
|
||||||
|
move 1 from 4 to 8
|
||||||
|
move 1 from 4 to 3
|
||||||
|
move 1 from 8 to 2
|
||||||
|
move 3 from 7 to 2
|
||||||
|
move 37 from 2 to 7
|
||||||
|
move 1 from 1 to 7
|
||||||
|
move 12 from 7 to 1
|
||||||
|
move 13 from 1 to 7
|
||||||
|
move 1 from 3 to 4
|
||||||
|
move 35 from 7 to 6
|
||||||
|
move 1 from 4 to 5
|
||||||
|
move 3 from 7 to 4
|
||||||
|
move 1 from 5 to 7
|
||||||
|
move 2 from 3 to 4
|
||||||
|
move 23 from 6 to 9
|
||||||
|
move 3 from 1 to 5
|
||||||
|
move 3 from 3 to 7
|
||||||
|
move 1 from 3 to 6
|
||||||
|
move 2 from 5 to 3
|
||||||
|
move 23 from 9 to 8
|
||||||
|
move 2 from 4 to 9
|
||||||
|
move 16 from 8 to 2
|
||||||
|
move 2 from 7 to 3
|
||||||
|
move 1 from 5 to 8
|
||||||
|
move 3 from 7 to 6
|
||||||
|
move 1 from 9 to 8
|
||||||
|
move 3 from 8 to 1
|
||||||
|
move 1 from 9 to 1
|
||||||
|
move 11 from 6 to 5
|
||||||
|
move 2 from 4 to 1
|
||||||
|
move 4 from 8 to 6
|
||||||
|
move 16 from 2 to 3
|
||||||
|
move 9 from 1 to 9
|
||||||
|
move 1 from 8 to 4
|
||||||
|
move 3 from 9 to 3
|
||||||
|
move 1 from 1 to 4
|
||||||
|
move 1 from 9 to 4
|
||||||
|
move 7 from 5 to 2
|
||||||
|
move 6 from 2 to 5
|
||||||
|
move 1 from 8 to 6
|
||||||
|
move 22 from 3 to 7
|
||||||
|
move 8 from 5 to 8
|
||||||
|
move 4 from 4 to 9
|
||||||
|
move 2 from 1 to 8
|
||||||
|
move 16 from 7 to 2
|
||||||
|
move 1 from 3 to 5
|
||||||
|
move 14 from 2 to 7
|
||||||
|
move 2 from 2 to 4
|
||||||
|
move 6 from 9 to 3
|
|
@ -0,0 +1,69 @@
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let input_file = common::parse_args_input_file(&mut std::env::args());
|
||||||
|
let contents = std::fs::read_to_string(input_file).expect("Couldn't read contents of input file");
|
||||||
|
let mut stacks = get_initial_stacks();
|
||||||
|
let mut stacks2 = get_initial_stacks();
|
||||||
|
for line in contents.lines() {
|
||||||
|
if line.eq("") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let words: Vec<&str> = line.split(' ').collect();
|
||||||
|
assert_eq!(words.len(), 6);
|
||||||
|
let mut count = usize::from_str(words[1]).unwrap();
|
||||||
|
let mut part2_count = count;
|
||||||
|
let from = usize::from_str(words[3]).unwrap() - 1;
|
||||||
|
let to = usize::from_str(words[5]).unwrap() - 1;
|
||||||
|
// Part 1 - CrateMover 9000
|
||||||
|
while count > 0 {
|
||||||
|
count -= 1;
|
||||||
|
let x = stacks[from].pop();
|
||||||
|
if x.is_none() {
|
||||||
|
println!("Breaking operation early, source stack empty: {} items from {} to {}", count, from, to);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stacks[to].push(x.unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Part 2 - CrateMover 9001, now with more leather.
|
||||||
|
// println!("Moving {} from stack: {:?}", part2_count, stacks2[from]);
|
||||||
|
if part2_count > stacks2[from].len() {
|
||||||
|
part2_count = stacks2[from].len();
|
||||||
|
}
|
||||||
|
let split_at = stacks2[from].len() - part2_count;
|
||||||
|
let mut clone = stacks2[from].clone();
|
||||||
|
let (remainder, moved) = clone.split_at_mut(split_at);
|
||||||
|
stacks2[from] = remainder.to_vec();
|
||||||
|
for x in moved {
|
||||||
|
stacks2[to].push(*x);
|
||||||
|
}
|
||||||
|
// println!("Source Stack '{}': {:?}", from, stacks2[from]);
|
||||||
|
// println!("Destination Stack '{}': {:?}", to, stacks2[to]);
|
||||||
|
}
|
||||||
|
let mut result = String::with_capacity(stacks.len());
|
||||||
|
for stack in stacks {
|
||||||
|
result.push(stack[stack.len()-1]);
|
||||||
|
}
|
||||||
|
let mut result2 = String::with_capacity(stacks2.len());
|
||||||
|
for stack in stacks2 {
|
||||||
|
result2.push(stack[stack.len()-1]);
|
||||||
|
}
|
||||||
|
println!("[PART 1] Top bins in stacks are: {}", result);
|
||||||
|
println!("[PART 2] Top bins in stacks are: {}", result2);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_initial_stacks() -> std::vec::Vec::<std::vec::Vec::<char>> {
|
||||||
|
let mut stacks = std::vec::Vec::<std::vec::Vec::<char>>::new();
|
||||||
|
stacks.push(vec!['Z', 'J', 'G']);
|
||||||
|
stacks.push(vec!['Q', 'L', 'R', 'P', 'W', 'F', 'V', 'C']);
|
||||||
|
stacks.push(vec!['F', 'P', 'M', 'C', 'L', 'G', 'R']);
|
||||||
|
stacks.push(vec!['L', 'F', 'B', 'W', 'P', 'H', 'M']);
|
||||||
|
stacks.push(vec!['G', 'C', 'F', 'S', 'V', 'Q']);
|
||||||
|
stacks.push(vec!['W', 'H', 'J', 'Z', 'M', 'Q', 'T', 'L']);
|
||||||
|
stacks.push(vec!['H', 'F', 'S', 'B', 'V']);
|
||||||
|
stacks.push(vec!['F', 'J', 'Z', 'S']);
|
||||||
|
stacks.push(vec!['M', 'C', 'D', 'P', 'F', 'H', 'B', 'T']);
|
||||||
|
return stacks;
|
||||||
|
}
|
Loading…
Reference in New Issue