You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
539 B
21 lines
539 B
use std::io::{self, BufRead};
|
|
|
|
mod game;
|
|
mod locations;
|
|
|
|
use crate::game::{Game, MAX_NUMBER_OF_STEPS};
|
|
|
|
fn main() {
|
|
let stdin = io::stdin();
|
|
let lines: Vec<_> = stdin.lock().lines().map(|line| line.unwrap()).collect();
|
|
|
|
let mut game = Game::from_input(&lines);
|
|
|
|
for i in 1..MAX_NUMBER_OF_STEPS {
|
|
let changes_count = game.next_step();
|
|
println!("Iteration {}; changed cells: {}; alive_cells: {}", i, changes_count, game.get_alive_count());
|
|
if changes_count == 0 {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|