Correct tab

This commit is contained in:
manzerbredes 2015-05-01 10:20:19 +02:00
parent 80c37e438e
commit 40e0b381c1

View file

@ -2,53 +2,53 @@
Game::Game() Game::Game()
{ {
m_grid = new Grid(4); m_grid = new Grid(4);
} }
Game::~Game() Game::~Game()
{ {
delete m_grid; delete m_grid;
} }
void Game::play() void Game::play()
{ {
while(!m_grid->gridIsFull()) while(!m_grid->gridIsFull())
{ {
m_grid->show(); m_grid->show();
pop(); pop();
std::cout << std::endl; std::cout << std::endl;
} }
m_grid->show(); m_grid->show();
} }
void Game::showGrid() void Game::showGrid()
{ {
m_grid->show(); m_grid->show();
std::cout << std::endl; std::cout << std::endl;
} }
void Game::pop() void Game::pop()
{ {
bool cellChosen = false; bool cellChosen = false;
int i; int i;
int j; int j;
while(!cellChosen) while(!cellChosen)
{ {
i = rand() % 4; i = rand() % 4;
j = rand() % 4; j = rand() % 4;
if (m_grid->isEmpty(i,j)) if (m_grid->isEmpty(i,j))
cellChosen = true; cellChosen = true;
} }
m_grid->setCell(i, j, new Cell("2")); m_grid->setCell(i, j, new Cell("2"));
} }
bool Game::isOver() bool Game::isOver()
{ {
return m_grid->gridIsFull(); return m_grid->gridIsFull();
} }