Question: C++ help code: C++ task: implement Conways Game of Life using vector basics. The grid is then transformed at regular intervals with each cells state

C++ help code: C++ task: implement Conways Game of Life using vector basics. The grid is then transformed at regular intervals with each cells state being updated according to the following set of simple rules:

  1. If a live cell has fewer than 2 neighbors, it dies (underpopulation).
  2. If a live cell has more than 3 neighbors, it dies (overpopulation).
  3. If a dead cell has exactly 3 neighbors, it becomes alive (reproduction).

I would like some help with this. can you tell me how to make a vector of a world and change it base on these rules? not really understanding the codes for vector basics.

I got this code to start out the world but im not sure if this is a easy way of doing it or what.

vector > world = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} };

am i suppose to apply the rules to the vector, write the result to standard output? if so how am i suppose to do it? and explanation would help

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!