ScummVM API documentation
grid.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef HODJNPODJ_LIFE_GRID_H
23 #define HODJNPODJ_LIFE_GRID_H
24 
25 namespace Bagel {
26 namespace HodjNPodj {
27 namespace Life {
28 
29 // For colony class
30 #define LIFE 1 // '+'
31 #define NO_LIFE 0 // '-'
32 #define BOARD_START_ROW 58
33 #define BOARD_START_COL 63
34 //#define BOARD_SPACING 1.5
35 #define BOARD_SPACING_TIMES_TWO 3
36 #define ROWS 15
37 #define COLS 20
38 
39 
40 class colony {
41  int grid[ROWS][COLS] = {};
42  int rows = 0, cols = 0;
43 public:
44 
45  //creator
46  colony(int r, int c);
47  colony(const colony &) = default;
48 
49  //destroy construct
50  ~colony();
51  //copy operator
52  colony &operator=(const colony &c);
53  //equality operators: assuming equal dims
54  bool operator==(const colony &c);
55  bool operator!=(const colony &c);
56 
57  //accessors
58  int row() const {
59  return rows;
60  };
61  int col() const {
62  return cols;
63  };
64  int islife(int r, int c) const {
65  return grid[r][c];
66  };
67  void evolve(const colony &c);
68  void flip(int r, int c);
69  //void print();
70 public:
71  int m_nColony_count = 0;
72 };
73 
74 } // namespace Life
75 } // namespace HodjNPodj
76 } // namespace Bagel
77 
78 #endif
Definition: grid.h:40
Definition: afxwin.h:27