diff --git a/examples/src/bin/multi_window_game_of_life/game_of_life.rs b/examples/src/bin/multi_window_game_of_life/game_of_life.rs index 6544abe8a6..b858450b7a 100644 --- a/examples/src/bin/multi_window_game_of_life/game_of_life.rs +++ b/examples/src/bin/multi_window_game_of_life/game_of_life.rs @@ -242,21 +242,21 @@ mod compute_life_cs { ivec2 left = pos + ivec2(-1, 0); int alive_count = 0; - if (life_out[get_index(up_left)] == 1) { alive_count += 1; } - if (life_out[get_index(up)] == 1) { alive_count += 1; } - if (life_out[get_index(up_right)] == 1) { alive_count += 1; } - if (life_out[get_index(right)] == 1) { alive_count += 1; } - if (life_out[get_index(down_right)] == 1) { alive_count += 1; } - if (life_out[get_index(down)] == 1) { alive_count += 1; } - if (life_out[get_index(down_left)] == 1) { alive_count += 1; } - if (life_out[get_index(left)] == 1) { alive_count += 1; } + if (life_in[get_index(up_left)] == 1) { alive_count += 1; } + if (life_in[get_index(up)] == 1) { alive_count += 1; } + if (life_in[get_index(up_right)] == 1) { alive_count += 1; } + if (life_in[get_index(right)] == 1) { alive_count += 1; } + if (life_in[get_index(down_right)] == 1) { alive_count += 1; } + if (life_in[get_index(down)] == 1) { alive_count += 1; } + if (life_in[get_index(down_left)] == 1) { alive_count += 1; } + if (life_in[get_index(left)] == 1) { alive_count += 1; } // Dead becomes alive. - if (life_out[index] == 0 && alive_count == 3) { + if (life_in[index] == 0 && alive_count == 3) { life_out[index] = 1; } // Becomes dead. - else if (life_out[index] == 1 && alive_count < 2 || alive_count > 3) { + else if (life_in[index] == 1 && alive_count < 2 || alive_count > 3) { life_out[index] = 0; } // Else do nothing.