Compare commits

..

No commits in common. "master" and "TheLie0-genesis" have entirely different histories.

View file

@ -2,25 +2,18 @@ extern crate console;
extern crate rand; extern crate rand;
use console::Term; use console::Term;
use std::thread::sleep;
use std::time::{Duration, Instant};
fn main() { fn main() {
let cutoff: f32 = 0.3; let cutoff: f32 = 0.3;
let frame_wait_time = Duration::from_millis(70);
let term = Term::stdout(); let term = Term::stdout();
let mut game = GameOfLife::new(255, 255, cutoff); let mut game = GameOfLife::new(255, 255, cutoff);
game.print_to_console(&term); game.print_to_console(&term);
let mut now = Instant::now();
sleep(frame_wait_time);
loop { loop {
game.update(); game.update();
if game.print_to_console(&term) == 0 { if game.print_to_console(&term) == 0 {
game = GameOfLife::new(255, 255, cutoff); game = GameOfLife::new(255, 255, cutoff);
} }
now = Instant::now();
sleep(frame_wait_time);
} }
} }
@ -119,9 +112,6 @@ fn random_one_or_zero_with_cutoff_point(cutoff: f32) -> u16 {
fn get_movement_score(cell: u16) -> usize { fn get_movement_score(cell: u16) -> usize {
if (cell & 0b0000000001111110) == ((cell & 0b0001111110000000) >> 6) { if (cell & 0b0000000001111110) == ((cell & 0b0001111110000000) >> 6) {
/*Checking the matching the last six states with the six before to find
out whether the cell is stagnant. The number six is chosen because it
encompasses all regular patterns of size 2, 3 and 6.*/
return 0; return 0;
} }
return 1; return 1;