#include "Grid.hpp" //Constructor Grid::Grid(): m_size(4), m_grid(4){ //Init all cells for(int i=0;i Grid::getRandomEmptyCellCoord(){ //Init list of candidate std::vector > candidates; //Construct list of candidates for(int i=0;iisEmpty(i,j)){ std::tuple currentCandidate(i,j); candidates.push_back(currentCandidate); } } } //If no candidate available if(candidates.size() == 0) return std::tuple(-1, -1); //Select the candidates int winnerIs(rand() % candidates.size()); //Return the candidate return candidates.at(winnerIs); } //Change value of cell bool Grid::setCell(std::tuple coord, int value){ int i=std::get<0>(coord); int j=std::get<1>(coord); if(i>=0 && i=0 && j coord(i,j); return this->setCell(coord, value); }