From 1b06a521d6941c9d902a24118080fdc4a7966e87 Mon Sep 17 00:00:00 2001 From: shivshank Date: Sat, 28 Jul 2018 17:15:30 -0400 Subject: [PATCH] Fix typo that broke the GOL! --- examples/game_of_life.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/game_of_life.rs b/examples/game_of_life.rs index d7d5ecd..6f4e47e 100644 --- a/examples/game_of_life.rs +++ b/examples/game_of_life.rs @@ -26,6 +26,12 @@ fn main() { cells[5 * WIDTH + 11] = true; cells[5 * WIDTH + 12] = true; + cells[50 * WIDTH + 50] = true; + cells[51 * WIDTH + 51] = true; + cells[52 * WIDTH + 49] = true; + cells[52 * WIDTH + 50] = true; + cells[52 * WIDTH + 51] = true; + let mut previous = SystemTime::now(); let mut extra_delay: f64 = 0.0; @@ -129,7 +135,7 @@ fn make_some_babies(cells: &mut [bool], neighbors: &mut [u32]) { if neighbors[cell] <= 1 { // die from under population cells[cell] = false; - } else if neighbors[cell] >= 3 { + } else if neighbors[cell] > 3 { // die from over population cells[cell] = false; }