SHARE
TWEET

Untitled

Hitsuji01 Dec 15th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void Gen(char map[row][col],int row, int col){
  2.  
  3.     srand(time(NULL));
  4.     int randRow_k = rand()%row;
  5.     int randCol_k = rand()%col;
  6.     map[randRow_k][randCol_k] = 'K';
  7.    
  8.     int randRow_p = rand()%row;
  9.     int randCol_p = rand()%col;
  10.    
  11.     if(randRow_k != randRow_p || randCol_k != randCol_p){
  12.    
  13.     map[randRow_p][randCol_p] = 'P';
  14.     }
  15.     else if (randRow_k == randRow_p && randCol_k == randCol_p){
  16.         randRow_p = rand()%row;
  17.         randCol_p = rand()%col;
  18.         map[randRow_p][randCol_p] = 'P';
  19.     }
  20. }
  21.  
  22. void player(char map[row][col],int row, int col){
  23.     srand(time(NULL));
  24.    
  25.    
  26.    
  27. }
  28. void update(char map[row][col],int row, int col){
  29.     int i,j;
  30.     for (i = 0; i < row;i++){
  31.         for (j = 0; j < col ; j++){
  32.             printf("%4c", map[i][j]);
  33.        
  34.            
  35.         }
  36.         printf("\n");
  37.        
  38.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top