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:
- If a live cell has fewer than 2 neighbors, it dies (underpopulation).
- If a live cell has more than 3 neighbors, it dies (overpopulation).
- 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started