Please don’t rely on this Gitea instance being around forever. If any of your build scripts use my (kageru’s) projects hosted here, check my Github or IEW on Github for encoding projects. If you can’t find what you’re looking for there, tell me to migrate it.
master
attila 4 years ago
parent 0c98f72052
commit e0c7e9f1a6

96
day10/Cargo.lock generated

@ -0,0 +1,96 @@
[[package]]
name = "aho-corasick"
version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cfg-if"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "day10"
version = "0.1.0"
dependencies = [
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lazy_static"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "memchr"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex-syntax"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "thread_local"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ucd-util"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "utf8-ranges"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "version_check"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74"
"checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9"
"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f"
"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"

@ -0,0 +1,8 @@
[package]
name = "day10"
version = "0.1.0"
authors = ["attila <daf276@gmx.de>"]
[dependencies]
regex = "1.1"
lazy_static = "1.2.0"

@ -0,0 +1,380 @@
position=<-41933, 10711> velocity=< 4, -1>
position=< 10721, -31361> velocity=<-1, 3>
position=<-52401, -20843> velocity=< 5, 2>
position=< 10666, -52404> velocity=<-1, 5>
position=< 31716, -20842> velocity=<-3, 2>
position=<-41914, -31366> velocity=< 4, 3>
position=<-31393, -20845> velocity=< 3, 2>
position=< 10706, 21233> velocity=<-1, -2>
position=< 21181, -31359> velocity=<-2, 3>
position=<-41881, 42273> velocity=< 4, -4>
position=< 42240, 10711> velocity=<-4, -1>
position=<-10376, -20842> velocity=< 1, 2>
position=< 42237, 21233> velocity=<-4, -2>
position=< 31716, -52404> velocity=<-3, 5>
position=< 42254, -41876> velocity=<-4, 4>
position=<-31406, -31364> velocity=< 3, 3>
position=<-20871, 21233> velocity=< 2, -2>
position=< 52740, -31362> velocity=<-5, 3>
position=<-20847, -52401> velocity=< 2, 5>
position=< 31708, 31754> velocity=<-3, -3>
position=< 52755, -10319> velocity=<-5, 1>
position=<-41877, -31358> velocity=< 4, 3>
position=<-31398, -31357> velocity=< 3, 3>
position=<-41877, 31749> velocity=< 4, -3>
position=< 21218, -31359> velocity=<-2, 3>
position=<-52410, -10324> velocity=< 5, 1>
position=< 21225, 42267> velocity=<-2, -4>
position=<-10376, 42273> velocity=< 1, -4>
position=< 52754, -31360> velocity=<-5, 3>
position=<-31355, 31752> velocity=< 3, -3>
position=< 21181, -10323> velocity=<-2, 1>
position=<-52419, -41876> velocity=< 5, 4>
position=< 42240, 42275> velocity=<-4, -4>
position=<-20853, -31366> velocity=< 2, 3>
position=<-31389, 31752> velocity=< 3, -3>
position=< 10713, -20843> velocity=<-1, 2>
position=< 10681, -31357> velocity=<-1, 3>
position=< 31749, -31366> velocity=<-3, 3>
position=<-10342, 31748> velocity=< 1, -3>
position=< 42253, 52786> velocity=<-4, -5>
position=<-41876, -31362> velocity=< 4, 3>
position=<-52436, -52401> velocity=< 5, 5>
position=<-31381, 10710> velocity=< 3, -1>
position=<-10376, 10713> velocity=< 1, -1>
position=<-20863, -31365> velocity=< 2, 3>
position=< 10713, -20842> velocity=<-1, 2>
position=<-20871, -41883> velocity=< 2, 4>
position=< 10722, -20847> velocity=<-1, 2>
position=< 21189, 42275> velocity=<-2, -4>
position=<-20834, 31751> velocity=< 2, -3>
position=<-10336, 21237> velocity=< 1, -2>
position=< 10710, 42273> velocity=<-1, -4>
position=<-41917, -52404> velocity=< 4, 5>
position=< 52754, -31364> velocity=<-5, 3>
position=< 10719, 52790> velocity=<-1, -5>
position=<-52431, -31364> velocity=< 5, 3>
position=< 52766, 10710> velocity=<-5, -1>
position=< 10680, -41876> velocity=<-1, 4>
position=< 21242, 52789> velocity=<-2, -5>
position=< 31737, 52795> velocity=<-3, -5>
position=<-52452, 10716> velocity=< 5, -1>
position=< 10699, 42272> velocity=<-1, -4>
position=< 52759, 10715> velocity=<-5, -1>
position=< 21240, 52786> velocity=<-2, -5>
position=< 42252, -31357> velocity=<-4, 3>
position=<-20887, 21237> velocity=< 2, -2>
position=< 31756, 21231> velocity=<-3, -2>
position=< 52762, -41882> velocity=<-5, 4>
position=< 42267, 52791> velocity=<-4, -5>
position=< 42270, 52786> velocity=<-4, -5>
position=< 42256, -52397> velocity=<-4, 5>
position=<-31397, -31362> velocity=< 3, 3>
position=<-31382, -41880> velocity=< 3, 4>
position=<-31390, -52403> velocity=< 3, 5>
position=< 21218, -10327> velocity=<-2, 1>
position=<-10336, -52403> velocity=< 1, 5>
position=< 21214, 10710> velocity=<-2, -1>
position=< 52746, 10710> velocity=<-5, -1>
position=< 31760, 21229> velocity=<-3, -2>
position=<-31358, 31751> velocity=< 3, -3>
position=< 52786, 52789> velocity=<-5, -5>
position=< 31713, -41876> velocity=<-3, 4>
position=< 31721, -41879> velocity=<-3, 4>
position=< 31732, -52402> velocity=<-3, 5>
position=< 10705, 52790> velocity=<-1, -5>
position=<-31409, -10327> velocity=< 3, 1>
position=<-52404, 10719> velocity=< 5, -1>
position=< 21213, -41878> velocity=<-2, 4>
position=< 21241, 21229> velocity=<-2, -2>
position=< 31724, -52400> velocity=<-3, 5>
position=<-52396, 21236> velocity=< 5, -2>
position=<-20869, -31362> velocity=< 2, 3>
position=<-41909, -20840> velocity=< 4, 2>
position=< 52786, 21231> velocity=<-5, -2>
position=< 42275, 31755> velocity=<-4, -3>
position=<-52399, -41882> velocity=< 5, 4>
position=<-52444, -20844> velocity=< 5, 2>
position=< 52770, -10322> velocity=<-5, 1>
position=<-52436, 52794> velocity=< 5, -5>
position=< 10710, 42269> velocity=<-1, -4>
position=<-52396, 31748> velocity=< 5, -3>
position=< 10720, -20847> velocity=<-1, 2>
position=< 31740, -31360> velocity=<-3, 3>
position=< 31720, 42276> velocity=<-3, -4>
position=<-52436, 52788> velocity=< 5, -5>
position=<-20895, 52790> velocity=< 2, -5>
position=< 21241, -31359> velocity=<-2, 3>
position=<-41933, -10328> velocity=< 4, 1>
position=<-41898, -20842> velocity=< 4, 2>
position=<-52399, -31365> velocity=< 5, 3>
position=<-20853, -31362> velocity=< 2, 3>
position=<-52436, -10322> velocity=< 5, 1>
position=<-52396, -20840> velocity=< 5, 2>
position=< 31756, 52786> velocity=<-3, -5>
position=<-20859, -31366> velocity=< 2, 3>
position=< 31728, -52400> velocity=<-3, 5>
position=<-10375, 31748> velocity=< 1, -3>
position=< 31716, 42270> velocity=<-3, -4>
position=<-31362, -52400> velocity=< 3, 5>
position=<-41909, -10325> velocity=< 4, 1>
position=< 52763, -41885> velocity=<-5, 4>
position=< 31736, -10320> velocity=<-3, 1>
position=< 10691, -31364> velocity=<-1, 3>
position=< 21202, 21236> velocity=<-2, -2>
position=< 31705, -10326> velocity=<-3, 1>
position=< 52772, 21229> velocity=<-5, -2>
position=< 10686, -31364> velocity=<-1, 3>
position=<-10320, -20841> velocity=< 1, 2>
position=<-20847, 42276> velocity=< 2, -4>
position=< 31708, -52400> velocity=<-3, 5>
position=<-10358, 10710> velocity=< 1, -1>
position=< 42275, 10716> velocity=<-4, -1>
position=<-20879, 10712> velocity=< 2, -1>
position=< 42255, -10320> velocity=<-4, 1>
position=< 21189, 52794> velocity=<-2, -5>
position=< 10686, 31756> velocity=<-1, -3>
position=<-31382, 42269> velocity=< 3, -4>
position=<-10374, 52790> velocity=< 1, -5>
position=< 10697, 31748> velocity=<-1, -3>
position=< 31749, -20843> velocity=<-3, 2>
position=< 31724, -31364> velocity=<-3, 3>
position=<-41909, 21235> velocity=< 4, -2>
position=<-20895, 42271> velocity=< 2, -4>
position=< 10699, -31357> velocity=<-1, 3>
position=<-20884, -10319> velocity=< 2, 1>
position=< 42259, 21233> velocity=<-4, -2>
position=< 52791, 21238> velocity=<-5, -2>
position=< 52794, -10325> velocity=<-5, 1>
position=<-20875, 21229> velocity=< 2, -2>
position=< 42222, -52404> velocity=<-4, 5>
position=<-10340, -10320> velocity=< 1, 1>
position=< 52756, 10714> velocity=<-5, -1>
position=< 52791, 42275> velocity=<-5, -4>
position=< 21194, 42276> velocity=<-2, -4>
position=< 42248, 31750> velocity=<-4, -3>
position=<-20871, -41881> velocity=< 2, 4>
position=<-31366, -52398> velocity=< 3, 5>
position=<-10336, -10326> velocity=< 1, 1>
position=< 42236, 10714> velocity=<-4, -1>
position=<-31397, 52786> velocity=< 3, -5>
position=<-52444, -10319> velocity=< 5, 1>
position=< 42254, -10323> velocity=<-4, 1>
position=<-10344, -20839> velocity=< 1, 2>
position=<-41872, -52396> velocity=< 4, 5>
position=< 42243, 42273> velocity=<-4, -4>
position=<-52410, -20843> velocity=< 5, 2>
position=<-20847, 42267> velocity=< 2, -4>
position=< 52781, 10710> velocity=<-5, -1>
position=<-52391, -41884> velocity=< 5, 4>
position=<-41925, -52399> velocity=< 4, 5>
position=< 42236, -31357> velocity=<-4, 3>
position=<-41880, 21231> velocity=< 4, -2>
position=< 31761, -10326> velocity=<-3, 1>
position=< 42235, 21238> velocity=<-4, -2>
position=<-41933, 10718> velocity=< 4, -1>
position=<-31413, -52400> velocity=< 3, 5>
position=< 10679, -20838> velocity=<-1, 2>
position=< 42278, -20843> velocity=<-4, 2>
position=<-41888, 52786> velocity=< 4, -5>
position=<-41916, -41881> velocity=< 4, 4>
position=<-10317, 21233> velocity=< 1, -2>
position=<-20860, -10319> velocity=< 2, 1>
position=<-31374, -52395> velocity=< 3, 5>
position=<-31413, 31748> velocity=< 3, -3>
position=< 10702, 42272> velocity=<-1, -4>
position=< 21198, 42267> velocity=<-2, -4>
position=<-31395, -31362> velocity=< 3, 3>
position=< 52758, 21238> velocity=<-5, -2>
position=< 10722, -41881> velocity=<-1, 4>
position=< 42260, -52400> velocity=<-4, 5>
position=< 52779, -52400> velocity=<-5, 5>
position=< 10711, 21229> velocity=<-1, -2>
position=<-31398, -20843> velocity=< 3, 2>
position=<-41912, -10321> velocity=< 4, 1>
position=< 42271, 21229> velocity=<-4, -2>
position=< 42279, 42273> velocity=<-4, -4>
position=< 42235, 31757> velocity=<-4, -3>
position=<-41914, 31757> velocity=< 4, -3>
position=< 31719, -31362> velocity=<-3, 3>
position=<-41906, -52400> velocity=< 4, 5>
position=<-10323, -41877> velocity=< 1, 4>
position=< 42247, 52790> velocity=<-4, -5>
position=< 42278, 10715> velocity=<-4, -1>
position=< 10718, -52395> velocity=<-1, 5>
position=<-52428, 21238> velocity=< 5, -2>
position=< 21209, 52786> velocity=<-2, -5>
position=<-52392, 42271> velocity=< 5, -4>
position=< 10682, 31757> velocity=<-1, -3>
position=< 31740, 42267> velocity=<-3, -4>
position=< 31756, -10323> velocity=<-3, 1>
position=< 31752, 31755> velocity=<-3, -3>
position=< 52788, -52400> velocity=<-5, 5>
position=< 31750, -41885> velocity=<-3, 4>
position=<-41925, 10713> velocity=< 4, -1>
position=<-20839, 52790> velocity=< 2, -5>
position=< 10705, 21233> velocity=<-1, -2>
position=<-20847, -52400> velocity=< 2, 5>
position=<-20871, -41885> velocity=< 2, 4>
position=< 31700, 52794> velocity=<-3, -5>
position=<-31374, -20839> velocity=< 3, 2>
position=< 21189, -10327> velocity=<-2, 1>
position=< 31724, -20841> velocity=<-3, 2>
position=< 42278, 52791> velocity=<-4, -5>
position=< 52778, -20847> velocity=<-5, 2>
position=< 42227, 21233> velocity=<-4, -2>
position=<-31390, 42268> velocity=< 3, -4>
position=< 10662, 10712> velocity=<-1, -1>
position=< 42259, -10319> velocity=<-4, 1>
position=<-52391, 10719> velocity=< 5, -1>
position=<-20890, -52403> velocity=< 2, 5>
position=< 10678, -41878> velocity=<-1, 4>
position=<-20892, 10710> velocity=< 2, -1>
position=<-52450, 21229> velocity=< 5, -2>
position=< 52798, 21235> velocity=<-5, -2>
position=<-10371, -52402> velocity=< 1, 5>
position=< 42237, 52795> velocity=<-4, -5>
position=<-52433, 31748> velocity=< 5, -3>
position=<-10351, 21229> velocity=< 1, -2>
position=< 52787, -20843> velocity=<-5, 2>
position=< 21213, 52792> velocity=<-2, -5>
position=< 42224, 21231> velocity=<-4, -2>
position=< 21241, -20841> velocity=<-2, 2>
position=< 52786, 31753> velocity=<-5, -3>
position=<-10367, 21238> velocity=< 1, -2>
position=<-10376, 52792> velocity=< 1, -5>
position=< 31744, 52790> velocity=<-3, -5>
position=<-20870, -20843> velocity=< 2, 2>
position=<-20879, -20841> velocity=< 2, 2>
position=< 10689, -52404> velocity=<-1, 5>
position=< 52775, 21237> velocity=<-5, -2>
position=<-10336, 31748> velocity=< 1, -3>
position=<-41901, -41880> velocity=< 4, 4>
position=< 42243, 31753> velocity=<-4, -3>
position=< 42270, -20847> velocity=<-4, 2>
position=< 21213, -20839> velocity=<-2, 2>
position=<-31406, -20845> velocity=< 3, 2>
position=<-41906, -52400> velocity=< 4, 5>
position=<-20866, 10711> velocity=< 2, -1>
position=<-20839, -20843> velocity=< 2, 2>
position=< 10699, -10322> velocity=<-1, 1>
position=<-52427, -20843> velocity=< 5, 2>
position=< 42252, -41876> velocity=<-4, 4>
position=<-10357, 31752> velocity=< 1, -3>
position=< 31732, 31754> velocity=<-3, -3>
position=< 42263, 31748> velocity=<-4, -3>
position=< 52794, -41880> velocity=<-5, 4>
position=<-41885, 10716> velocity=< 4, -1>
position=<-52420, -52396> velocity=< 5, 5>
position=< 42259, -20840> velocity=<-4, 2>
position=< 10674, 31757> velocity=<-1, -3>
position=<-10355, 31751> velocity=< 1, -3>
position=< 10719, -20843> velocity=<-1, 2>
position=< 21197, 42268> velocity=<-2, -4>
position=< 31735, 42272> velocity=<-3, -4>
position=< 42240, 31749> velocity=<-4, -3>
position=< 21194, 31757> velocity=<-2, -3>
position=< 52763, -10328> velocity=<-5, 1>
position=<-41933, -52402> velocity=< 4, 5>
position=<-52403, -10328> velocity=< 5, 1>
position=<-41906, 10710> velocity=< 4, -1>
position=<-41912, -31364> velocity=< 4, 3>
position=<-20887, 10717> velocity=< 2, -1>
position=< 31736, 31748> velocity=<-3, -3>
position=< 31756, -41884> velocity=<-3, 4>
position=<-41913, 31752> velocity=< 4, -3>
position=< 31708, 21233> velocity=<-3, -2>
position=<-52404, -31366> velocity=< 5, 3>
position=< 42262, -20847> velocity=<-4, 2>
position=< 31710, -20838> velocity=<-3, 2>
position=< 52770, -41881> velocity=<-5, 4>
position=<-52396, 42275> velocity=< 5, -4>
position=< 52754, 10713> velocity=<-5, -1>
position=<-20894, -10324> velocity=< 2, 1>
position=< 42277, 31748> velocity=<-4, -3>
position=<-31414, 31749> velocity=< 3, -3>
position=<-20846, -52400> velocity=< 2, 5>
position=< 21205, -10319> velocity=<-2, 1>
position=< 52796, 10714> velocity=<-5, -1>
position=<-41882, 31752> velocity=< 4, -3>
position=<-10364, -52395> velocity=< 1, 5>
position=< 31733, 21229> velocity=<-3, -2>
position=<-20866, 21232> velocity=< 2, -2>
position=< 42276, -10328> velocity=<-4, 1>
position=<-31409, -31365> velocity=< 3, 3>
position=< 42237, 21229> velocity=<-4, -2>
position=< 21217, 52791> velocity=<-2, -5>
position=<-41881, 10714> velocity=< 4, -1>
position=<-31382, -10324> velocity=< 3, 1>
position=< 42278, 42267> velocity=<-4, -4>
position=<-52409, 42267> velocity=< 5, -4>
position=<-31366, 31748> velocity=< 3, -3>
position=<-41893, -10319> velocity=< 4, 1>
position=< 31724, -52404> velocity=<-3, 5>
position=< 10702, -31363> velocity=<-1, 3>
position=<-52451, 10710> velocity=< 5, -1>
position=<-20895, -31364> velocity=< 2, 3>
position=< 21184, -20843> velocity=<-2, 2>
position=< 42275, 10719> velocity=<-4, -1>
position=< 52748, 52795> velocity=<-5, -5>
position=<-20895, 10711> velocity=< 2, -1>
position=<-52444, -20844> velocity=< 5, 2>
position=< 31753, -10326> velocity=<-3, 1>
position=< 21186, -31363> velocity=<-2, 3>
position=< 21221, -10327> velocity=<-2, 1>
position=<-52404, -52397> velocity=< 5, 5>
position=<-10323, -10325> velocity=< 1, 1>
position=< 21201, 31752> velocity=<-2, -3>
position=< 10678, -20840> velocity=<-1, 2>
position=< 31721, -52403> velocity=<-3, 5>
position=< 42272, 52795> velocity=<-4, -5>
position=< 52794, 10712> velocity=<-5, -1>
position=< 10672, 21238> velocity=<-1, -2>
position=< 21215, 31757> velocity=<-2, -3>
position=<-31388, -20843> velocity=< 3, 2>
position=< 21229, -52396> velocity=<-2, 5>
position=< 42224, -10325> velocity=<-4, 1>
position=<-10352, -41880> velocity=< 1, 4>
position=<-52451, -41881> velocity=< 5, 4>
position=<-52452, -20843> velocity=< 5, 2>
position=< 52740, -52404> velocity=<-5, 5>
position=< 31748, 31749> velocity=<-3, -3>
position=<-41893, -31358> velocity=< 4, 3>
position=< 10691, -20846> velocity=<-1, 2>
position=<-20859, 31748> velocity=< 2, -3>
position=< 10662, -52396> velocity=<-1, 5>
position=<-20863, 52789> velocity=< 2, -5>
position=<-31356, -31362> velocity=< 3, 3>
position=< 21215, -10319> velocity=<-2, 1>
position=<-52420, -52400> velocity=< 5, 5>
position=<-52394, -10328> velocity=< 5, 1>
position=<-41877, 42269> velocity=< 4, -4>
position=<-31388, 42271> velocity=< 3, -4>
position=<-10347, -41882> velocity=< 1, 4>
position=< 42259, 52792> velocity=<-4, -5>
position=< 42270, -20842> velocity=<-4, 2>
position=< 21202, -41882> velocity=<-2, 4>
position=<-52411, -52404> velocity=< 5, 5>
position=<-41917, 42267> velocity=< 4, -4>
position=<-20847, -41876> velocity=< 2, 4>
position=< 31732, 42274> velocity=<-3, -4>
position=< 52757, 31748> velocity=<-5, -3>
position=< 31737, -20846> velocity=<-3, 2>
position=< 21237, 52789> velocity=<-2, -5>
position=< 21181, 21238> velocity=<-2, -2>
position=< 31745, -41885> velocity=<-3, 4>
position=< 42223, -52400> velocity=<-4, 5>
position=< 52791, 21238> velocity=<-5, -2>
position=< 52786, 21231> velocity=<-5, -2>
position=<-10324, 21233> velocity=< 1, -2>
position=< 42223, -10324> velocity=<-4, 1>
position=<-52399, -31365> velocity=< 5, 3>
position=< 10678, 52790> velocity=<-1, -5>
position=< 52746, 52791> velocity=<-5, -5>
position=< 42235, -52403> velocity=<-4, 5>
position=<-20851, 10714> velocity=< 2, -1>
position=<-31388, -10328> velocity=< 3, 1>
position=<-31390, -20838> velocity=< 3, 2>
position=<-20874, 42272> velocity=< 2, -4>
position=<-10339, -52397> velocity=< 1, 5>
position=< 52783, 52786> velocity=<-5, -5>

@ -0,0 +1,85 @@
#[macro_use]
extern crate lazy_static;
extern crate regex;
use regex::Regex;
struct Star {
x: i32,
y: i32,
x_vel: i32,
y_vel: i32,
}
impl Star {
pub fn new(x: i32, y: i32, x_vel: i32, y_vel: i32) -> Self {
Star {
x, y, x_vel, y_vel
}
}
}
lazy_static! {
static ref STAR_REGEX: Regex = Regex::new(r"position=<\s?(-?\d+),\s{1,2}(-?\d+)>\svelocity=<\s?(-?\d+),\s{1,2}(-?\d+)>").unwrap();
}
fn main() {
let lines: Vec<&str> = include_str!("../input").lines().collect();
let mut stars: Vec<Star> = lines.iter().map(|line| parse_star(line)).collect();
let mut min_y: i32 = 0;
let mut max_y: i32 = 11;
let mut step = 0;
while (max_y - min_y).abs() > 10 {
stars.iter_mut().for_each(|star| {
star.x += star.x_vel;
star.y += star.y_vel;
});
min_y = stars.iter().min_by_key(|a| a.y).unwrap().y;
max_y = stars.iter().max_by_key(|a| a.y).unwrap().y;
step += 1;
}
// Part 1
print_stars(&stars);
// Part 2
println!("{}", step);
}
fn print_stars(stars: &Vec<Star>) {
let min_x = stars.iter().min_by_key(|a| a.x).unwrap().x;
let max_x = stars.iter().max_by_key(|a| a.x).unwrap().x;
let min_y= stars.iter().min_by_key(|a| a.y).unwrap().y;
let max_y = stars.iter().max_by_key(|a| a.y).unwrap().y;
let width: i32 = max_x - min_x;
let height: i32 = max_y - min_y;
let line = vec!('.'; (width + 1) as usize);
let mut field = vec!(line.clone(); (height + 1) as usize);
for star in stars {
field[(star.y - min_y) as usize][(star.x - min_x) as usize] = '#';
}
for l in field {
let s: String = l.into_iter().collect();
println!("{}", s);
}
}
fn parse_star(input: &str) -> Star {
let captures = STAR_REGEX.captures(input).expect("unexpected input line");
let (x, y, x_vel, y_vel): (i32, i32, i32, i32);
x = captures.get(1).unwrap().as_str().parse::<i32>().unwrap();
y = captures.get(2).unwrap().as_str().parse::<i32>().unwrap();
x_vel = captures.get(3).unwrap().as_str().parse::<i32>().unwrap();
y_vel = captures.get(4).unwrap().as_str().parse::<i32>().unwrap();
return Star::new(x, y, x_vel, y_vel);
}
Loading…
Cancel
Save