Game of Life in C++

Hey there people. This will be my first post in this forum, pleased to meet you all.
So, I have received this assignment for my college class of Object Oriented Programming, requesting from me a C++ code that would implement a simpler version of John Conway's Game of Life, using classes, inheritance and polymorphism. I'm still a beginner at programming, so despite knowing the theories I am not able to use them in a complex program like this one and don't know where to start from or anything.

I'm linking here a website that contains the basics, rules and formats that the game is able to produce:http://www.pickinpatchfarm.com/gameoflife/

Please help me, I would be really grateful.
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.

We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem really is "I don't understand a thing", then you should go back to basics and study again.


Even the most complex program is nothing more than a combination of simple pieces. Break your task into smaller pieces. Tackle each separately.
I understand. Do forgive me, it indeed seemed like I was asking for my assignment to be done.
Just an idea to get you started:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const int GRID_VIEW = 1;
const int TEXT_VIEW = 2;

/**
 * Represents the field of the game of life - i.e. 2d array
 */
class Field
{

};

/** Represents the view of the game of life
 *
 */
class View
{
  virtual void show() = 0;
};


class TextView : public View
{
public:
  void show();
};

class GridView : public View
{
public:
  void show();
};

/**
 * Represents the game of lfe
 */
class Game
{
public:
  Game(int viewType);
  void run(int steps);
  void show();
private: 
  Field mField;
  View *mView;
};

int main()
{
  Game game(GRID_VIEW);
  game.show();
  game.run(10);
  game.show();
}
in c/c++ you have to provide include guards to prevent multiple definitions:
Topic archived. No new replies allowed.
  • 1007451581 2018-02-22
  • 8908121580 2018-02-22
  • 141161579 2018-02-22
  • 9421578 2018-02-22
  • 2826901577 2018-02-22
  • 3647361576 2018-02-22
  • 5717551575 2018-02-22
  • 523811574 2018-02-22
  • 6439871573 2018-02-22
  • 8109431572 2018-02-22
  • 8757321571 2018-02-22
  • 5265111570 2018-02-22
  • 3351351569 2018-02-22
  • 5109361568 2018-02-22
  • 4455391567 2018-02-22
  • 9091121566 2018-02-22
  • 24791565 2018-02-22
  • 2486841564 2018-02-21
  • 9847231563 2018-02-21
  • 9264681562 2018-02-21