summaryrefslogtreecommitdiff
path: root/src/Model/Grid.cpp
blob: ade3f74e0e6f31fd6e86fc73182e1abf9955e4cb (plain)
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
#include "Grid.hpp"


Grid::Grid(int size)
{
	m_table = std::vector<std::vector<Cell*> >(size);
	for(int i = 0 ; i < size ; i++)
	{
		m_table[i] = std::vector<Cell*>(size);
		for (int j = 0 ; j < size ; j++)
		{
			Cell * cell = new Cell();
			m_table[i][j] = cell;
		}
	}
}

Grid::~Grid()
{
	for(int i = 0 ; i < m_table.size() ; i++)
	{
		for(int j = 0 ; j < m_table[i].size() ; j++)
			delete m_table[i][j];
	}
}

void Grid::afficher()
{
	for(int i = 0 ; i < m_table.size() ; i++)
	{
		for(int j = 0 ; j < m_table[i].size() ; j++)
		{
			std::cout << m_table[i][j]->description();
		}
		std::cout << std::endl;
	}
}