This commit is contained in:
Daniel Flanagan 2022-12-09 11:42:37 -06:00
parent c91fc6106d
commit e6076d7853
Signed by untrusted user: lytedev-divvy
GPG Key ID: 6D69CEEE4ABBCD82
1 changed files with 2 additions and 0 deletions

View File

@ -49,10 +49,12 @@ fn both_parts(input: &Input) -> (Answer, Answer) {
_ => None,
} {
for _ in 0..i.1 {
// move part 1 head/tail
h = (h.0 + x, h.1 + y);
t = follow(h, t);
p1.insert(t);
// move part 2 rope
r[0] = (r[0].0 + x, r[0].1 + y);
for s in 1..r.len() {
r[s] = follow(r[s - 1], r[s]);