Add Simulation Saving and Loading Methods

This commit is contained in:
Unknown 2018-10-19 19:59:00 +02:00
parent befb345ddd
commit 0da2d08b74
2 changed files with 16 additions and 0 deletions

View file

@ -10,6 +10,8 @@ enum CellPattern { SpaceShip, Blinker }
class Simulation {
Grid<bool> map;
Grid<bool> _snapshot;
RuleSet rules = GameOfLife();
bool _dirty = true;
@ -151,4 +153,7 @@ class Simulation {
_renderEdges = on;
_dirty = true;
}
void saveSnapshot() => _snapshot = map;
Grid<bool> loadSnapshot() => map = _snapshot;
}