daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Oct 11th, 2018 60 in 2 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. // long argument list
  6. int eat(bool board[8][8], int n, int m, int pr, int pc, int eatCount);
  7.  
  8. int main(){
  9.     int n, m;
  10.     cin >> n >> m;
  11.  
  12.     bool board[8][8];
  13.  
  14.     // initialize
  15.     for(int i = 0; i < 8; i++){
  16.         for(int j = 0; j < 8; j++){
  17.             if(i < n && j < m) board[i][j] = true;
  18.             else board[i][j] = false;
  19.  
  20.         }          
  21.  
  22.     }
  23.  
  24.     board[0][0] = false;
  25.  
  26.     // passing 2D array of unknown size seems to be
  27.     // either very hard or just impossible
  28.  
  29.     // alt solution: declare an array of max possible size
  30.     // and pass the boundaries
  31.     cout << eat(board, n, m, 0, 0, 0) << endl;
  32.  
  33.    
  34.     return 0;
  35. }
  36.  
  37. int eat(bool board[8][8], int n, int m, int pr, int pc, int eatCount){
  38.  
  39.     int tmpCount = 0;
  40.  
  41.     // up
  42.     for(int i = pr; i >= 0; i--){
  43.         if(board[i][pc]) tmpCount++;
  44.         if(tmpCount == 2){
  45.             vector<vector <bool> > boardCopy;
  46.         }
  47.     }
  48.  
  49.     // down
  50.  
  51.     // left
  52.     // right
  53.  
  54.  
  55.  
  56. }
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
 
Top