联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2023-05-12 10:09

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/


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp