Lab Week #1 Objectives • Use basic principles of object -oriented programming. • Get experience with C++ programming. Rules • Teamwork is allowed (make sure all team members understand the source code) . • Use your preferred IDE (Visual Studio , JetBrains Rider , Xcode, Code::Block , etc.) . • Using code from Internet is not allowed . • Comments y our files. Work • Implement the Game of Life in C++ with some constraints. • Game of life ’s rules o an infinite, two -dimensional orthogonal grid of square cells o each cell is in one of two possible states, live or dead o every cell interacts with its eight neighbours :
- Any live cell with fewer than two live neighbours dies .
- Any live cell with two or three live neighbours lives on to the next generation.
- Any live cell with more than three live neighbours dies on to the next generation .
- Any dead cell with exactly three live neighbours becomes a live cell on to the next generation . Steps
- First version a. The grid size can be set. b. The simulation runs until the user triggers a stop signal . c. Following function s required i. run(): performs one generation ii. display(): shows the c urrent states iii. init() : init the grid
- Second version (Can be your first steps if you feel comfortable ) a. Define class Automaton to model the simulation. b. Can pause and resume simulation.
- Third version a. Define class Cell i. Each c ell is in charge of computing its steps for the next generation. ii. Cell displays its state
- Fourth version a. Can save and load current generation in a file. b. Cells can detect some patterns and inform the user.
- Fifth version a. The user can change the state of a cell during runtime. b. The simulation can be reverted ( Revert to the previous state of a generation )
- Sixth version ++ a. Any update you would like to try. Thank you ! Resources • https://en.wikipedia.org/wiki/Conway's_Game_of_Life • https://playgameoflife.com/ • https://conwaylife.com/