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