summaryrefslogtreecommitdiffstats
path: root/examples/game_of_life
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-29 23:55:15 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-29 23:55:15 +0200
commit611d9e399c95268a3daf41bd6cbcc55391ccff87 (patch)
tree58af23aa7cdf14b5b79085e79484fde926757486 /examples/game_of_life
parent5e014a70e864964570e4c1568926b8c647f73c59 (diff)
downloadiced-611d9e399c95268a3daf41bd6cbcc55391ccff87.tar.gz
iced-611d9e399c95268a3daf41bd6cbcc55391ccff87.tar.bz2
iced-611d9e399c95268a3daf41bd6cbcc55391ccff87.zip
Clarify `tick` logic in `game_of_life`
Diffstat (limited to 'examples/game_of_life')
-rw-r--r--examples/game_of_life/src/main.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs
index fb12afa1..3989e3ea 100644
--- a/examples/game_of_life/src/main.rs
+++ b/examples/game_of_life/src/main.rs
@@ -200,14 +200,12 @@ mod grid {
let is_populated = self.alive_cells.contains(&(i, j));
match amount {
- 2 if is_populated => {}
+ 2 | 3 if is_populated => {}
3 => {
- if !is_populated {
- self.alive_cells.insert((i, j));
- }
+ let _ = self.alive_cells.insert((i, j));
}
_ if is_populated => {
- self.alive_cells.remove(&(i, j));
+ let _ = self.alive_cells.remove(&(i, j));
}
_ => {}
}