Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //beginning
- int co1, co2;
- //these are coordinates to be used in checks later
- //once dimensions have been chosen
- obnum = dimensions - 1;
- //once the answer to the question "Do you want to populate the board with obstacles?" has been confirmed as yes or no
- if (yes == 0){
- do{
- do{
- co1 = (rand() % dimensions) + 2;
- co2 = (rand() % dimensions) + 3;
- }while (array[co1][co2] != '.');
- array[co1][co2] = 'X';
- obnum--;
- }while(obnum > 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement