Add 4 random pop support with a probability of 10%
This commit is contained in:
parent
870d354afd
commit
30f603ecd3
1 changed files with 11 additions and 1 deletions
|
@ -48,7 +48,17 @@ bool Game::isOver(){
|
||||||
void Game::popRandomNumber(){
|
void Game::popRandomNumber(){
|
||||||
std::tuple<int, int> coord(m_grid.getRandomEmptyCellCoord());
|
std::tuple<int, int> coord(m_grid.getRandomEmptyCellCoord());
|
||||||
|
|
||||||
int number=2;
|
int percent=rand() % 100;
|
||||||
|
|
||||||
|
int number;
|
||||||
|
|
||||||
|
if(percent <= 10){
|
||||||
|
number=4;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
number=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
m_grid.setCell(coord, number);
|
m_grid.setCell(coord, number);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue