diff --git a/src/main.rs b/src/main.rs index 4978703..8625995 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,9 +38,11 @@ fn main() { let step_digits = format!("{steps}").len(); for i in 0..steps { rng.fill_bytes(&mut rolls); + let GameStep { old, new } = game.step(last, &mut rng, &rolls); game = new; last = old; + game.write_to_buffer(&mut buffer); let path = format!("{output_prefix}{i:0OUTPUT_DIGITS$}.png"); @@ -48,6 +50,7 @@ fn main() { eprintln!("error saving image: {e}"); process::exit(1); } + eprintln!("step {:step_digits$}/{steps}", i + 1); } } @@ -151,7 +154,7 @@ impl Game { assert_eq!(self.height as u32, buffer.height()); for x in 0..self.width { for y in 0..self.height { - buffer[(x as u32, y as u32)] = self.at(x, y).unwrap().color(); + buffer.put_pixel(x as u32, y as u32, self.at(x, y).unwrap().color()); } } }