Initial commit

This commit is contained in:
Sebastian Knackstedt 2022-12-06 11:44:37 +01:00
commit 41b1b887b3
Signed by: sebastian
GPG Key ID: CDCD9AF904D93EF7
18 changed files with 7035 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/target
.idea
.fleet

7
Cargo.lock generated Normal file
View File

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

36
Cargo.toml Normal file
View File

@ -0,0 +1,36 @@
[package]
name = "aoc22"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "base"
path = "src/lib.rs"
[[bin]]
name = "day1"
path = "src/day1/main.rs"
[[bin]]
name = "day2"
path = "src/day2/main.rs"
[[bin]]
name = "day3"
path = "src/day3/main.rs"
[[bin]]
name = "day4"
path = "src/day4/main.rs"
[[bin]]
name = "day5"
path = "src/day5/main.rs"
[[bin]]
name = "day6"
path = "src/day6/main.rs"
[dependencies]

2242
day1.txt Normal file

File diff suppressed because it is too large Load Diff

2500
day2.txt Normal file

File diff suppressed because it is too large Load Diff

300
day3.txt Normal file
View File

@ -0,0 +1,300 @@
hqBqJsqHhHvhHHqlBvlfpHQQwLVzVwtVzjzttjQVSjMjwL
gRTRnCRsFNGbTzLjwcSTMmSz
dGgsRWPGdWgZJqBBqhfpPq
HNCNJHCWJRRLqNJWlfrrrwsmlwGmmf
dddvLdLjdDvjvswlmGwlZQtjrt
dvcpbLVcvNJJHNPHSp
QDprSpLQRLQrQDmQcQFZjbbhZwdRsRFbbBss
gWGGPgNvJlgJzDlNGHCGPNZZgFBbsjbFFBwZwfhdZbZB
lHTlGMHlGCPNvClzGzJHvGcrMcVtLqMLcrrQVcVDrqrm
SrBpJFfldlFNslFJBZwsmwgVGGsCCVmZZD
jLtjvzLQMtWjbbQvDZZwGRJGgwggGZgv
MzqqjznQPqnnjznnctnFlSddPfHflhfBJF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NJgdfdQlqlLNdhgGLhp

1000
day4.txt Normal file

File diff suppressed because it is too large Load Diff

513
day5.txt Normal file
View File

@ -0,0 +1,513 @@
[N] [Q] [N]
[R] [F] [Q] [G] [M]
[J] [Z] [T] [R] [H] [J]
[T] [H] [G] [R] [B] [N] [T]
[Z] [J] [J] [G] [F] [Z] [S] [M]
[B] [N] [N] [N] [Q] [W] [L] [Q] [S]
[D] [S] [R] [V] [T] [C] [C] [N] [G]
[F] [R] [C] [F] [L] [Q] [F] [D] [P]
1 2 3 4 5 6 7 8 9
move 3 from 9 to 4
move 2 from 5 to 2
move 8 from 1 to 9
move 4 from 7 to 1
move 5 from 3 to 8
move 3 from 3 to 7
move 11 from 8 to 3
move 7 from 3 to 6
move 2 from 5 to 9
move 3 from 1 to 6
move 6 from 2 to 4
move 6 from 7 to 5
move 1 from 6 to 1
move 1 from 9 to 4
move 16 from 4 to 9
move 2 from 1 to 2
move 1 from 4 to 6
move 1 from 3 to 7
move 2 from 2 to 4
move 1 from 7 to 9
move 22 from 9 to 8
move 1 from 6 to 3
move 18 from 8 to 5
move 3 from 8 to 2
move 3 from 2 to 9
move 13 from 6 to 7
move 1 from 6 to 7
move 4 from 3 to 6
move 2 from 6 to 3
move 2 from 3 to 8
move 3 from 7 to 8
move 14 from 5 to 2
move 3 from 2 to 5
move 2 from 8 to 4
move 4 from 8 to 6
move 4 from 6 to 4
move 11 from 5 to 2
move 3 from 9 to 2
move 7 from 2 to 3
move 11 from 7 to 2
move 1 from 5 to 7
move 5 from 6 to 8
move 30 from 2 to 7
move 23 from 7 to 2
move 4 from 3 to 4
move 3 from 9 to 6
move 4 from 8 to 2
move 1 from 8 to 2
move 2 from 7 to 9
move 4 from 2 to 3
move 1 from 5 to 9
move 6 from 4 to 7
move 5 from 3 to 6
move 1 from 3 to 6
move 1 from 9 to 2
move 16 from 2 to 5
move 7 from 7 to 6
move 9 from 2 to 1
move 2 from 1 to 4
move 8 from 5 to 3
move 5 from 7 to 4
move 1 from 9 to 8
move 9 from 3 to 6
move 25 from 6 to 8
move 2 from 9 to 5
move 3 from 4 to 2
move 7 from 4 to 1
move 1 from 8 to 7
move 6 from 5 to 2
move 11 from 8 to 5
move 1 from 7 to 9
move 10 from 1 to 2
move 6 from 5 to 1
move 1 from 4 to 2
move 13 from 8 to 1
move 17 from 1 to 2
move 5 from 1 to 9
move 1 from 8 to 4
move 1 from 1 to 3
move 1 from 3 to 6
move 1 from 9 to 3
move 2 from 4 to 5
move 1 from 4 to 8
move 1 from 9 to 1
move 8 from 5 to 7
move 1 from 8 to 1
move 7 from 7 to 6
move 2 from 1 to 2
move 1 from 3 to 6
move 2 from 5 to 4
move 8 from 2 to 1
move 1 from 9 to 7
move 1 from 5 to 1
move 2 from 7 to 3
move 2 from 3 to 7
move 2 from 7 to 8
move 2 from 1 to 5
move 3 from 9 to 2
move 2 from 8 to 9
move 1 from 9 to 2
move 1 from 9 to 8
move 1 from 8 to 7
move 6 from 6 to 5
move 1 from 6 to 2
move 2 from 4 to 5
move 2 from 6 to 8
move 1 from 7 to 1
move 2 from 8 to 4
move 11 from 2 to 5
move 18 from 5 to 6
move 6 from 2 to 6
move 10 from 2 to 7
move 1 from 4 to 3
move 7 from 2 to 8
move 7 from 1 to 4
move 6 from 7 to 8
move 2 from 7 to 3
move 8 from 4 to 7
move 1 from 1 to 3
move 1 from 2 to 1
move 4 from 7 to 1
move 4 from 1 to 3
move 2 from 3 to 9
move 2 from 5 to 4
move 1 from 2 to 1
move 2 from 1 to 5
move 1 from 3 to 1
move 2 from 5 to 2
move 1 from 2 to 6
move 5 from 7 to 4
move 1 from 1 to 2
move 10 from 8 to 1
move 2 from 2 to 7
move 2 from 7 to 1
move 1 from 7 to 9
move 1 from 5 to 7
move 3 from 8 to 7
move 3 from 3 to 6
move 3 from 7 to 1
move 5 from 1 to 4
move 1 from 7 to 6
move 22 from 6 to 3
move 2 from 6 to 2
move 19 from 3 to 4
move 15 from 4 to 8
move 9 from 8 to 4
move 5 from 6 to 8
move 2 from 2 to 8
move 2 from 9 to 4
move 7 from 1 to 5
move 1 from 1 to 3
move 1 from 9 to 7
move 5 from 8 to 3
move 4 from 8 to 1
move 5 from 1 to 5
move 10 from 4 to 3
move 3 from 4 to 2
move 2 from 8 to 3
move 12 from 4 to 8
move 1 from 7 to 6
move 3 from 2 to 9
move 2 from 4 to 5
move 5 from 3 to 7
move 1 from 7 to 2
move 1 from 1 to 6
move 1 from 7 to 2
move 15 from 3 to 8
move 10 from 5 to 6
move 3 from 7 to 8
move 1 from 5 to 8
move 1 from 2 to 3
move 7 from 6 to 1
move 3 from 5 to 3
move 5 from 3 to 5
move 3 from 5 to 4
move 2 from 4 to 9
move 2 from 3 to 5
move 14 from 8 to 5
move 1 from 9 to 1
move 16 from 5 to 3
move 16 from 3 to 6
move 2 from 9 to 8
move 21 from 6 to 7
move 2 from 1 to 7
move 1 from 2 to 7
move 4 from 1 to 7
move 1 from 4 to 7
move 16 from 8 to 5
move 20 from 7 to 4
move 1 from 9 to 8
move 1 from 7 to 4
move 3 from 8 to 6
move 1 from 9 to 1
move 2 from 1 to 4
move 2 from 5 to 2
move 5 from 4 to 7
move 1 from 6 to 9
move 11 from 7 to 6
move 2 from 7 to 5
move 12 from 6 to 2
move 13 from 2 to 1
move 1 from 2 to 3
move 1 from 8 to 4
move 6 from 4 to 1
move 1 from 6 to 7
move 7 from 4 to 9
move 8 from 9 to 3
move 2 from 8 to 3
move 10 from 5 to 4
move 11 from 1 to 8
move 1 from 1 to 3
move 5 from 1 to 8
move 8 from 5 to 6
move 13 from 8 to 9
move 12 from 3 to 5
move 12 from 5 to 9
move 1 from 7 to 9
move 1 from 1 to 2
move 1 from 1 to 4
move 3 from 8 to 5
move 1 from 2 to 5
move 1 from 4 to 8
move 5 from 6 to 3
move 1 from 8 to 4
move 13 from 4 to 7
move 3 from 7 to 6
move 1 from 1 to 4
move 4 from 4 to 2
move 1 from 6 to 3
move 2 from 5 to 9
move 2 from 5 to 9
move 1 from 4 to 8
move 6 from 9 to 4
move 22 from 9 to 2
move 8 from 7 to 4
move 7 from 2 to 1
move 3 from 3 to 8
move 2 from 6 to 7
move 14 from 4 to 2
move 2 from 6 to 1
move 1 from 8 to 7
move 3 from 3 to 9
move 1 from 8 to 4
move 3 from 1 to 9
move 3 from 9 to 3
move 31 from 2 to 8
move 8 from 8 to 4
move 1 from 9 to 1
move 9 from 4 to 5
move 7 from 5 to 6
move 2 from 5 to 1
move 1 from 2 to 1
move 1 from 7 to 9
move 1 from 2 to 9
move 2 from 6 to 4
move 4 from 7 to 4
move 4 from 9 to 8
move 6 from 4 to 1
move 1 from 3 to 2
move 1 from 3 to 6
move 1 from 9 to 2
move 2 from 2 to 4
move 1 from 9 to 1
move 1 from 3 to 1
move 17 from 1 to 9
move 4 from 6 to 2
move 1 from 9 to 7
move 4 from 9 to 7
move 1 from 8 to 4
move 3 from 7 to 6
move 1 from 4 to 9
move 10 from 8 to 5
move 6 from 6 to 5
move 1 from 7 to 2
move 1 from 1 to 4
move 1 from 4 to 5
move 9 from 8 to 3
move 4 from 3 to 9
move 1 from 4 to 6
move 1 from 6 to 5
move 1 from 4 to 8
move 2 from 3 to 8
move 1 from 3 to 8
move 3 from 8 to 9
move 5 from 2 to 9
move 1 from 7 to 9
move 5 from 8 to 7
move 3 from 8 to 4
move 2 from 8 to 5
move 24 from 9 to 7
move 1 from 3 to 5
move 2 from 9 to 4
move 22 from 7 to 9
move 1 from 3 to 4
move 6 from 4 to 6
move 4 from 6 to 7
move 10 from 5 to 3
move 8 from 3 to 5
move 2 from 3 to 4
move 2 from 4 to 6
move 10 from 7 to 3
move 21 from 9 to 1
move 2 from 3 to 4
move 4 from 3 to 8
move 2 from 4 to 8
move 1 from 7 to 8
move 4 from 6 to 8
move 3 from 5 to 4
move 8 from 8 to 2
move 18 from 1 to 6
move 3 from 4 to 1
move 1 from 2 to 8
move 5 from 1 to 8
move 3 from 3 to 6
move 3 from 2 to 9
move 3 from 8 to 1
move 11 from 5 to 2
move 3 from 8 to 7
move 10 from 2 to 9
move 1 from 7 to 9
move 3 from 8 to 1
move 2 from 7 to 8
move 6 from 9 to 5
move 4 from 2 to 8
move 8 from 5 to 8
move 1 from 3 to 7
move 2 from 5 to 6
move 3 from 1 to 6
move 2 from 1 to 6
move 4 from 9 to 8
move 4 from 9 to 8
move 1 from 9 to 4
move 9 from 6 to 9
move 16 from 6 to 9
move 1 from 4 to 7
move 1 from 2 to 9
move 5 from 8 to 5
move 4 from 5 to 1
move 6 from 1 to 7
move 12 from 8 to 4
move 5 from 8 to 1
move 6 from 9 to 3
move 1 from 1 to 6
move 2 from 5 to 8
move 12 from 4 to 7
move 2 from 8 to 4
move 1 from 4 to 8
move 1 from 7 to 6
move 1 from 4 to 6
move 14 from 7 to 1
move 3 from 3 to 2
move 7 from 9 to 7
move 3 from 3 to 5
move 15 from 1 to 2
move 2 from 5 to 9
move 1 from 8 to 9
move 16 from 9 to 1
move 1 from 5 to 9
move 5 from 6 to 2
move 12 from 7 to 2
move 20 from 2 to 6
move 10 from 2 to 6
move 11 from 1 to 7
move 2 from 7 to 4
move 2 from 2 to 5
move 1 from 2 to 3
move 2 from 5 to 6
move 1 from 9 to 5
move 1 from 5 to 9
move 25 from 6 to 7
move 25 from 7 to 6
move 1 from 3 to 1
move 1 from 2 to 5
move 1 from 4 to 3
move 33 from 6 to 3
move 1 from 9 to 5
move 2 from 3 to 5
move 28 from 3 to 9
move 5 from 1 to 9
move 4 from 1 to 8
move 2 from 3 to 2
move 2 from 8 to 1
move 1 from 4 to 6
move 3 from 5 to 3
move 1 from 2 to 4
move 2 from 2 to 8
move 1 from 6 to 5
move 30 from 9 to 2
move 7 from 2 to 6
move 1 from 1 to 3
move 1 from 1 to 7
move 1 from 5 to 6
move 1 from 5 to 4
move 5 from 7 to 4
move 4 from 7 to 3
move 1 from 3 to 7
move 3 from 8 to 7
move 8 from 3 to 1
move 3 from 1 to 7
move 4 from 1 to 4
move 3 from 9 to 8
move 8 from 6 to 2
move 18 from 2 to 6
move 6 from 7 to 2
move 1 from 1 to 7
move 3 from 4 to 7
move 5 from 4 to 8
move 2 from 8 to 7
move 7 from 2 to 5
move 5 from 2 to 7
move 10 from 7 to 9
move 5 from 5 to 9
move 1 from 3 to 9
move 5 from 2 to 6
move 3 from 7 to 9
move 2 from 5 to 6
move 2 from 2 to 9
move 2 from 8 to 7
move 1 from 4 to 5
move 8 from 9 to 2
move 5 from 6 to 7
move 4 from 9 to 1
move 4 from 8 to 9
move 12 from 9 to 1
move 16 from 1 to 4
move 12 from 6 to 2
move 3 from 7 to 6
move 3 from 7 to 3
move 1 from 9 to 4
move 12 from 4 to 5
move 2 from 4 to 3
move 1 from 7 to 1
move 4 from 4 to 3
move 1 from 8 to 2
move 6 from 3 to 1
move 1 from 1 to 8
move 7 from 2 to 5
move 1 from 8 to 1
move 4 from 5 to 4
move 5 from 5 to 9
move 1 from 3 to 8
move 1 from 9 to 7
move 1 from 8 to 1
move 4 from 5 to 6
move 5 from 5 to 9
move 7 from 9 to 5
move 11 from 6 to 4
move 1 from 9 to 4
move 1 from 9 to 1
move 1 from 7 to 2
move 9 from 4 to 3
move 5 from 1 to 9
move 3 from 5 to 1
move 5 from 9 to 8
move 8 from 3 to 1
move 2 from 5 to 3
move 7 from 2 to 5
move 1 from 6 to 4
move 3 from 5 to 9
move 3 from 6 to 9
move 3 from 2 to 9
move 5 from 3 to 6
move 1 from 9 to 5
move 4 from 8 to 3
move 1 from 8 to 4
move 8 from 1 to 3
move 12 from 3 to 7
move 1 from 2 to 4
move 3 from 2 to 8
move 6 from 7 to 6
move 4 from 5 to 7
move 5 from 9 to 7
move 2 from 9 to 2
move 1 from 9 to 5
move 4 from 5 to 1
move 1 from 5 to 4
move 14 from 7 to 6
move 1 from 1 to 7
move 10 from 4 to 5
move 4 from 1 to 2
move 1 from 4 to 6
move 1 from 7 to 4
move 17 from 6 to 8
move 1 from 5 to 7
move 10 from 5 to 4
move 1 from 2 to 6
move 4 from 2 to 6
move 13 from 6 to 1
move 9 from 4 to 3
move 2 from 2 to 4
move 1 from 6 to 7
move 1 from 4 to 3
move 8 from 3 to 5
move 1 from 3 to 4
move 17 from 1 to 3
move 15 from 3 to 7
move 3 from 4 to 1
move 6 from 8 to 9
move 6 from 9 to 1
move 2 from 3 to 1
move 2 from 5 to 2
move 6 from 7 to 6
move 3 from 6 to 9

9
day5_test.txt Normal file
View File

@ -0,0 +1,9 @@
[D]
[N] [C]
[Z] [M] [P]
1 2 3
move 1 from 2 to 1
move 3 from 1 to 3
move 2 from 2 to 1
move 1 from 1 to 2

1
day6.txt Normal file
View File

@ -0,0 +1 @@
pqffvllhrhthvhshhpnhpnpqpvpvrpvpwvwjjdssmcsmccjvjmjjwnjwjwhjwwwzswwhvhwwlvvlbvbtbzbfbzbtbqbgbpbggwzggvjjdpdffbmffntncchtccbcffcjfjnjfnntssvtstzssmnnhrhlhbbwfwjfwjfwwbhhfhmmpsssbnssssfzzfpffdrdpdqqvnncjjgrjjmhhpqqcjqcjjzdzzpvvprrlglrrcmcqqtltdltddswsrrzzwgzzgssczcmzzmgmwgmggwwzttpccmcsmmvfvnvppzlzvzllgclggpfggfnfrfvrvwwvhwwvgwwrbbgfglflblzblzbznzhzffplffnrrcqqsgsvshvhlldhhvnhhmdddnssdvdwdwccggmddsmswwtctdtqqjsshhjzzdpdmpdmppjtjwjswjsjjjsdjjtrtbrbjjwwvnvppqphqhwhcwhwbbpgbbnhbnhhswwdswwlcczdztzbbbnwwtmmpvvgjjqgqdqzzdjdpjjnnffhccscvvchhbmbcbffpdpggvdvttpvpqqhggdtdhtdhhmghmgggzwgwrgwggwlggvpggcfcttzmtmgmvgmmpqmqlmqllsqqjbjwjsszczlzrzgrzzhshlhjjwttwnntbtjtjpplccqrqhrhssbmbttrddfvfwwjcwcvwcwwvpvggqwgwjgwgccvqqcmqqtqnqpnqnffdqfqhhqnhnmhmvhmhwwfrwrggnmmmcnmmgsszmzlmzmddcwwthtssgjsgjjgpgnppdqqcgqggzjgjngnrnggvffgddvtvctcftcftfnnnnhssbgsgwwthtqtltftqtnqttsrtrggwcgwcwmwgmgvmmzrmzrzjzmmcclmmtjmjhmmlhlwlppnpccbbrlrqrcrjrdrlrnngmnmvmcmzczztbblglccvzvppzspsddrzzlsllfzfsspnpdnpnvvvgmmpccmpcpgcpcwcddtmddgwgngqqcpqqlhqqczqqbvqqgdqgqmgmlmmvrrgfgzffbccldcdmmcmcgcngnghngngdngdndcncbbpqbbphbphpccpcwwjswwfttbqbsszccrbbdndsdrdqrqjrjjbmbtbdbbgbvgvcggwdwcccttqccnffjpjqqzpzlzvlljhhschhzlhhfhcfhchvcvtvtgvgzvzrvrdrgrwrjwjljhljlssszsqzsswhhmlhlrhlhzzgghjhzjjcllwrwtrrbdbrbnrnprnrffjvvphhvbbqbbscstsmslmlvmvrmmvvngnlnzzwqzzjqqsqbqrrtmrtmmfgmgrgjjtmjmrrddmrrqmrrjmjqmqnqmmcmlmfmffcgcclplffzvzwvzzjtztftqftqffjjpwjjbpjjggzdgzgwzzfrfvvhfvvwcvvbccfcvffpcpgpbbqhbbhmmzfmfvvnjvnjjhzhqqmffndndmmzhmmqnnlglvvjhjddvggqwgwdgwdggqbqgqrqlrrtptsswlssqwssbdsdrsddjsszjszjjpnjnvnjvnnmznmnddccpwwhshzzcfcqcwcddsjjmnjmjljwwgmglllqlhhctcvvqrvrrhfrrbcrrfbrfbrfrqffbwbqwbbjggsjjjnqqrqsqhhwnhnshnhhdjjqfqpqmmqgqgqggzmmnncrrpgglgqlqclqlsqqwnnfntnzttrnnmtmvvfppbrprzpzzdzvvtctnncpclpccsbbswwcscjssvhvhhqggzmgmqgmgwwgcwgccrllzhzzlzlbljbllmqqpjqqhrhqhjhbbjmjmhmddmwmcmvvmbbmvbmmznnwvwlwtllhwlwgwpgplgpgmgngjgglbglgmllvvlttgrrrlsrllghlggjdjwwfjwfjfvhjmgqnwhwpbdtzrphsqbmmvscslhbdzffsfshgsdjbqbwlgmrtschcnfhdlnndsvpwmwttfglpghhznmgfcjsdlwhnmfqvmpvhgpnnwtjfztbmtprqhsqtjwzhwcqjtjbtqwlcldnvggrwddmpllwnrqwdljwzfzqwcdwgqwvnthnrpcsfwrmqvbzjvzqnmdnfgtbzgtnrvblfwmhdsddgbffnjzvjzfpwglctpqhnqdvtblcchrlmndzhlsczgnsmnbwgnjngnjtlrdpfhqjrwcrqvcpspbtwcvgvvmpnwqjjpdpnslmcrcjnjmhqmrmfbcmrcmpbcbhpcvwqwflljfpgdvqhgdwgcphjqfnqzjjpsqnbtfzhftjtfcbhhcmmlwcfznsflfpphprrgvqwfgjcwfgjfsghzcbqrldwrjlzlbjhpgrbmgdpgzmfsqsphqbbslwwpzspccrhcfrgcjlfwhlcmzdcltbbpcrzglqgqntpwtmgstqlmcsqqbsqgmsmfznwcrfdgvsmnfqmwtsvqvlhwwjlrlhnsvcnrtwwmrjcgfncvlrcqrllndlvmrjpfjpgrrjcwhsqvlbtnlqgwjjqzwcvtvlnfnmqqshbcnqtcbvnwtwbfdgqmvnpmjhlsfdntfwwntvsrrsmspzqmglfnprjtdbmbgnplzzclsjpnzwdhcbhpfnqrgmgqtpfhgnfbqhrpmznbrshjhntzctslwhtgtjvpqhntmchhtncfjmbzcgnpcbpmldrtnpvrzqfftbjjcjlpwwgvmnstjghftcczjzfsftgzpfhbspqmrbfhcdfmqbrgrbsmjvgpbrnvbblwwvqzzpmqrspzvzppjfbgfftdvsdvmrjzhfslptzmgndnqqgmrrfnbbpvbmvpngwjhzvfbwfnzlrgwffvjsfdldfgchfjmnzfnzhwrwttrzlrhmnwvjjdqfmbpfllhrgmddjgnwjnbqwjnslcrdjrmnldcpsgzjpdhrpdfwhbvwhwnhcsmwcwstvqrcrqsnvjrzljfgbljfszchbsqnldgntvcscwqqmpnlwtlfmswtmvrlpzgbrjhtgjgpnhggnprpvwfqpjffqhtfvpnrptgrtwzzlvplgnfjmqphgmnssccrdndqgpljtwtntshrpgsjcdrpmccjnjdgmpmzbfhqjzphcswtwvvqcrwsjhtdqgrhqjmjjcrblpswcblnpzvfztqtbpgjcgngqmwrjtlmhvlsbmrdzwlgqlfqcqnsnjcnddssqbftjvnlgcwwfcgdpdmqrdsjmcnzrfrpnvjmbsltpzwjhjzqqvbgrltczbgvcpwdzqsvhddsbjgjgcmnldrfhnhddlvjcvsnghprjwlghhtghldcqsdcdgnmbcjglvjjvvlbhzczlmjsdqtdpzdtvfztgsdfjsdtfchvzcgvhjnnncmsrfvvmcsjjdftmlpczgvtwngssqmzlmsrrsrbhhhrnwqhmpcdvqmdsvvtsgsqfdcpgsdgzvmbzpbpgtcbshnvdzlmpnwmqrvnmrjprmvppjwfbjhlhzsfhqqzmpbclqvsvfrcqwprrcvqcbbwvnqfwnrgjhlwmgzpfspqrvqrhmqnwvzjrhvvgdgswlvzjjhjtdctlthlpzqhjvwwbpsclpgflcnsdshrqbhmczcwljqlndfnfrcdgmptpsltrcjccnpdchgnswdcpsslcslcjznzpgfhznhbgqhdqvddmqzdnmpshhdcjrsmfjllhfvjvmzzhzrvlbpzqngwmlwcmqnppqzncvjshfrpjlptvnqfrfcrfnbhwhpdqqvjhsqvsmprtgfrddwzjzlwhhqvjpfrwgwvwpszzsfzwjtwngdjfllhjrmqjtmvwsvggnswpqpjbtcrnhhhlzbrvhjdstnpctjlgsffrrbfdvjzhwsgthgfsqnvqdcjffsttlrjnhtqqdpfqpjtdgfwcdwzmwfvqgglsrmmqwbszclpzwldwcswpwfwldrfmmdndcptjbmnvgcpntqcdrcffvgnlpjmcqjpfmbmwjfpqzbzhqtqbzsghbnfvhphfzzhfznttpfrqwpmzjchpzzrdclhdltlqbjmjdfdjqlqbwptsghcnvtdscwgpqnlhhvsvglplhlrwpnzmdbsbrlhmpczzfz

1
day6_test.txt Normal file
View File

@ -0,0 +1 @@
bvwbjplbgvbhsrlpgdmjqwftvncz

20
src/day1/main.rs Normal file
View File

@ -0,0 +1,20 @@
use base::*;
fn main() {
let lines = read_file("day1.txt");
let mut sums: Vec<u32> = vec![];
lines.split(|line|line.is_empty()).for_each(|sub|
sums.push(sub.iter().map(|line|line.parse::<u32>().expect("Error while parsing")).sum())
);
sums.sort();
sums.reverse();
let top = &sums[0..=2];
top.iter().enumerate().for_each(|(index, cal)|
println!("{}. with value {cal}", index + 1)
);
let sum = top.iter().sum::<u32>();
println!("Sums of top three: {sum}");
}

140
src/day2/main.rs Normal file
View File

@ -0,0 +1,140 @@
use base::*;
#[derive(Debug, PartialEq, Clone, Copy)]
enum Move {
Rock,
Paper,
Scissors
}
enum GameResult {
Win,
Draw,
Lose
}
impl GameResult {
pub fn from_str(c: &str) -> GameResult {
return match c {
"X" => {GameResult::Lose}
"Y" => {GameResult::Draw}
"Z" | _ => {GameResult::Win}
}
}
}
impl Move {
pub fn from_str(c: &str) -> Move {
return match c {
"A" | "X" => {
Move::Rock
}
"B" | "Y" => {
Move::Paper
}
"C" | "Z" | _ => {
Move::Scissors
}
}
}
pub fn score(self) -> u32 {
return match self {
Move::Rock => {1}
Move::Paper => {2}
Move::Scissors => {3}
}
}
pub fn result(self, other: Move) -> GameResult {
if self == other {
return GameResult::Draw;
}
match self {
Move::Rock => {
if other == Move::Scissors {
return GameResult::Win
}
}
Move::Paper => {
if other == Move::Rock {
return GameResult::Win
}
}
Move::Scissors => {
if other == Move::Paper {
return GameResult::Win
}
}
}
GameResult::Lose
}
}
struct GameMove(Move, Move);
impl GameMove {
fn calc_score(&self) -> u32 {
let result = self.1.result(self.0);
let score = self.1.score();
return match result {
GameResult::Win => {
score + 6
}
GameResult::Draw => {
score + 3
}
GameResult::Lose => {
score
}
}
}
fn from_opponent_move(opponent_move: Move, result: GameResult) -> GameMove {
return match result {
GameResult::Draw => {
GameMove(opponent_move, opponent_move)
}
GameResult::Win => {
let our_move = match opponent_move {
Move::Rock => {Move::Paper}
Move::Paper => {Move::Scissors}
Move::Scissors => {Move::Rock}
};
GameMove(opponent_move, our_move)
}
GameResult::Lose => {
let our_move = match opponent_move {
Move::Rock => {Move::Scissors}
Move::Paper => {Move::Rock}
Move::Scissors => {Move::Paper}
};
GameMove(opponent_move, our_move)
}
}
}
}
fn main() {
let lines = read_file("day2.txt");
let sum = lines.iter().map(|line| {
let symbols_per_move = line.split(" ");
let mut symbols_iter = symbols_per_move.map(|symbol| Move::from_str(symbol)).take(2);
GameMove(symbols_iter.next().unwrap(), symbols_iter.next().unwrap())
}).map(|game_move|game_move.calc_score()).sum::<u32>();
println!("Task 1: Got sum: {sum}");
let sum = lines.iter().map(|line| {
let mut symbols_per_move = line.split(" ");
GameMove::from_opponent_move(Move::from_str(symbols_per_move.next().unwrap()), GameResult::from_str(symbols_per_move.next().unwrap()))
}).map(|game_move|game_move.calc_score()).sum::<u32>();
println!("Task 2: Got sum: {sum}");
}

58
src/day3/main.rs Normal file
View File

@ -0,0 +1,58 @@
use base::*;
fn calc_prio(item: char) -> u32{
if item.is_lowercase() {
item as u32 - ('a' as u32) + 1
} else {
item as u32 - ('A' as u32) + 27
}
}
fn main() {
let lines = read_file("day3.txt");
let sum = lines.iter()
.map(|line|line.split_at(line.len() / 2))
.map(|(first_half, second_half)| {
for char_0 in first_half.chars() {
for char_1 in second_half.chars() {
if char_0 == char_1 {
return Some(char_0);
}
}
}
None
})
.map(|item| {
match item{
None => 0,
Some(item) => calc_prio(item)
}
}).sum::<u32>();
println!("Task 1: {sum}");
let sum = lines.chunks_exact(3).map(|chunk| {
for char_0 in chunk[0].chars() {
for char_1 in chunk[1].chars() {
if char_0 == char_1 {
for char_2 in chunk[2].chars() {
if char_1 == char_2 {
return Some(char_0);
}
}
}
}
}
None
}).map(|item|{
match item {
None => 0,
Some(item) => calc_prio(item)
}
}).sum::<u32>();
println!("Task 2: {sum}");
}

68
src/day4/main.rs Normal file
View File

@ -0,0 +1,68 @@
use std::fs::read_to_string;
struct Range {
start: u32,
end: u32
}
impl Range {
fn new(start: u32 , end: u32) -> Self{
Range {start, end}
}
fn contains(&self, number: u32) -> bool {
number >= self.start && number <= self.end
}
fn fully_overlap(&self, other: &Range) -> bool {
self.contains(other.start) && self.contains(other.end)
}
fn partly_overlap(&self, other: &Range) -> bool {
self.contains(other.start) || self.contains(other.end)
}
}
fn main() {
let input = read_to_string("day4.txt").unwrap();
let count = input
.split_whitespace()
.flat_map(|line| line.split(","))
.flat_map(|line_range| line_range.split("-"))
.map(|number| number.parse::<u32>().unwrap())
.collect::<Vec<_>>()
.chunks_exact(2)
.map(|chunk| Range::new(chunk[0], chunk[1]))
.collect::<Vec<_>>()
.chunks_exact(2)
.filter_map(|range_pair|{
if range_pair[0].fully_overlap(&range_pair[1]) || range_pair[1].fully_overlap(&range_pair[0]) {
Some(())
}
else { None }
})
.count();
println!("Task1: {count}");
let count = input
.split_whitespace()
.flat_map(|line| line.split(","))
.flat_map(|line_range| line_range.split("-"))
.map(|number| number.parse::<u32>().unwrap())
.collect::<Vec<_>>()
.chunks_exact(2)
.map(|chunk| Range::new(chunk[0], chunk[1]))
.collect::<Vec<_>>()
.chunks_exact(2)
.filter_map(|range_pair|{
if range_pair[0].partly_overlap(&range_pair[1]) || range_pair[1].partly_overlap(&range_pair[0]) {
Some(())
}
else { None }
})
.count();
println!("Task2: {count}");
}

100
src/day5/main.rs Normal file
View File

@ -0,0 +1,100 @@
use std::collections::HashMap;
use base::read_file;
#[derive(Debug, Clone)]
struct CrateStorage {
stacks: HashMap<usize, Vec<char>>
}
impl CrateStorage {
fn print_top(&self) {
for k in 0..(9 as usize) {
match self.stacks.get(&k) {
None => {
print!(" ")
}
Some(v) => {
print!("{}", v[v.len() - 1]);
}
}
}
println!()
}
}
#[derive(Debug)]
struct MoveOp {
amount: usize,
from: usize,
to: usize
}
impl MoveOp {
fn apply(&self, storge: &mut CrateStorage, task_1 : bool) {
if task_1 {
for _ in 0..self.amount {
let vec = storge.stacks.get_mut(&self.from).unwrap();
let element = vec.remove(vec.len() - 1);
storge.stacks.get_mut(&self.to).unwrap().push(element);
}
} else {
let mut temp = vec![];
for _ in 0..self.amount {
let vec = storge.stacks.get_mut(&self.from).unwrap();
temp.push(vec.remove(vec.len() - 1));
}
temp.reverse();
for i in 0..self.amount {
storge.stacks.get_mut(&self.to).unwrap().push(temp[i]);
}
}
dbg!(&storge);
}
}
fn main() {
let lines = read_file("day5_test.txt");
let mut storage = CrateStorage{
stacks: HashMap::new()
};
let mut moves =vec![];
for line in lines {
if line.starts_with("[") {
let mut iter = line.chars().enumerate();
loop {
match iter.next() {
Some((idx, char)) => {
if char == '[' {
let idx = idx / 4;
if let Some((_, value)) = iter.next() {
let vec = storage.stacks.entry(idx).or_insert_with(|| Vec::new());
vec.insert(0, value);
} else {
break;
}
}
}
None => break
}
}
} else if line.starts_with("move") {
let split = line.split_whitespace().collect::<Vec<_>>();
let amount = split[1].parse::<usize>().unwrap();
let from = split[3].parse::<usize>().unwrap() - 1;
let to = split[5].parse::<usize>().unwrap() - 1;
moves.push(MoveOp{amount, from, to});
}
}
let mut storage_task_1 = storage.clone();
moves.iter().for_each(|move_op| move_op.apply(&mut storage_task_1, true));
storage_task_1.print_top();
let mut storage_task_2 = storage;
moves.iter().for_each(|move_op| move_op.apply(&mut storage_task_2, false));
storage_task_2.print_top();
}

21
src/day6/main.rs Normal file
View File

@ -0,0 +1,21 @@
use std::collections::HashSet;
use std::fs::read_to_string;
fn find_marker(content: &str, size: usize) -> Option<usize> {
for (idx, chars) in content.chars().collect::<Vec<_>>().windows(size).enumerate() {
let set = chars.iter().map(|char|*char).collect::<HashSet<_>>();
if set.len() == size {
let idx = idx + size;
return Some(idx);
}
}
None
}
fn main() {
let content = read_to_string("day6.txt").unwrap();
println!("Task 1: {}", find_marker(&content, 4).unwrap());
println!("Task 2: {}", find_marker(&content, 14).unwrap());
}

16
src/lib.rs Normal file
View File

@ -0,0 +1,16 @@
use std::fs::File;
use std::io::{BufRead, BufReader};
pub fn read_file(name: &str) -> Vec<String> {
let file = File::open(name);
return match file {
Ok(file) => {
BufReader::new(file).lines().map(|line|line.ok()).flatten().collect::<Vec<_>>()
}
Err(_) => {
vec![]
}
}
}