Skip to content

Commit

Permalink
wip day22 part2
Browse files Browse the repository at this point in the history
  • Loading branch information
qselle committed Jan 7, 2025
1 parent 52a874f commit e8c6de3
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/day22.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,29 @@ pub fn part1(input: &[usize]) -> usize {
}

#[aoc(day22, part2)]
pub fn part2(_input: &[usize]) -> usize {
pub fn part2(input: &[usize]) -> usize {
let mut onces:Vec<Vec<usize>> = vec![];

for secret in input {
let mut secret = *secret;

for _ in 0..2000 {
let mut tmp;

let operations = [
|s: usize| s * 64, // step1
|s: usize| s / 32, // step2
|s: usize| s * 2048, // step3
];

for op in operations {
tmp = op(secret);
secret ^= tmp;
secret %= PRUNE;
}
}
total += secret;

Check failure on line 59 in src/day22.rs

View workflow job for this annotation

GitHub Actions / Check

cannot find value `total` in this scope
}
0
}

Expand Down

0 comments on commit e8c6de3

Please sign in to comment.