Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago

Question

e. What do you know about your ethnic background?

Answered: 1 week ago