首页 > > 详细

C++编程设计辅导、辅导program

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 your 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:
1. Any live cell with fewer than two live neighbours dies.
2. Any live cell with two or three live neighbours lives on to the next generation.
3. Any live cell with more than three live neighbours dies on to the next generation.
4. Any dead cell with exactly three live neighbours becomes a live cell on to the next
generation.
Steps
1. First version
a. The grid size can be set.
b. The simulation runs until the user triggers a stop signal.
c. Following functions required
i. run(): performs one generation
ii. display(): shows the current states
iii. init(): init the grid
2. 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.
3. Third version
a. Define class Cell
i. Each cell is in charge of computing its steps for the next generation.
ii. Cell displays its state
4. Fourth version
a. Can save and load current generation in a file.
b. Cells can detect some patterns and inform the user.
5. 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)
6. 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/

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!