Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. void Board::initBoard(){
  2.     emptyCell.clear();
  3.  
  4.     for (int i = 0; i < BOARD_HEIGHT; i++){
  5.         for (int j = 0; j < BOARD_WIDTH; j++){
  6.             boardM[i][j] = 0;
  7.             Cell c;
  8.             c.posX = i;
  9.             c.posY = j;
  10.             emptyCell.push_back(c);
  11.         }
  12.     }
  13. }
  14.  
  15. void Board::randomBall(){
  16.     srand (time(NULL));
  17.  
  18.     int prand =  rand() % emptyCell.size();
  19.     boardM[ emptyCell[prand].posX ][ emptyCell[prand].posY ] = rand() % 6 + 1;
  20.  
  21.     emptyCell.erase(emptyCell.begin() + prand);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement