Modify show() method presentation
This commit is contained in:
parent
9f07e3c6bd
commit
a7e0de4bb6
1 changed files with 12 additions and 2 deletions
|
@ -1,10 +1,13 @@
|
|||
#include "Grid.hpp"
|
||||
|
||||
|
||||
//Constructor
|
||||
Grid::Grid(int size)
|
||||
{
|
||||
//Create Vector
|
||||
m_size = size;
|
||||
m_table = std::vector<std::vector<Cell*> >(size);
|
||||
|
||||
//Init all of line and cell
|
||||
for(int i = 0 ; i < size ; i++)
|
||||
{
|
||||
m_table[i] = std::vector<Cell*>(size);
|
||||
|
@ -16,6 +19,7 @@ Grid::Grid(int size)
|
|||
}
|
||||
}
|
||||
|
||||
//Destructor
|
||||
Grid::~Grid()
|
||||
{
|
||||
for(int i = 0 ; i < m_size ; i++)
|
||||
|
@ -25,16 +29,22 @@ Grid::~Grid()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Grid::show()
|
||||
{
|
||||
std::cout << "_________________" << std::endl;
|
||||
std::cout << std::endl;
|
||||
for(int i = 0 ; i < m_size ; i++)
|
||||
{
|
||||
std::cout << "|";
|
||||
for(int j = 0 ; j < m_size ; j++)
|
||||
{
|
||||
std::cout << m_table[i][j]->description();
|
||||
std::cout << " " << m_table[i][j]->description() << " |";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << "_________________" << std::endl;
|
||||
}
|
||||
|
||||
bool Grid::isEmpty(int i, int j)
|
||||
|
|
Loading…
Add table
Reference in a new issue