Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int board[8][8] = {
- {0, 1, 0, 0, 1, 1, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0},
- {1, 1, 0, 0, 1, 0, 0, 0},
- {1, 1, 0, 0, 1, 0, 0, 1},
- {0, 0, 0, 1, 0, 1, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0},
- {1, 1, 1, 1, 1, 0, 0, 0},
- {1, 0, 0, 1, 1, 0, 1, 0}
- };
- int check_board(int x, int y) {
- if( x < 0 || x >= 8 || y < 0 || y >= 8)
- return 0;
- else if(board[x][y] == 0)
- return 0;
- else {
- board[x][y] = 0;
- return 1+ check_board(x-1, y) + check_board(x+1, y) + check_board(x, y-1) + check_board(x, y+1);
- }
- }
- int main() {
- int pool, br = 0;
- for(int i = 0; i < 8; ++i) {
- for(int j = 0; j < 8; ++j) {
- if(board[i][j] == 1) {
- br++;
- pool = check_board(i, j);
- cout << "\nBoard #: " << br << "-- Pool: "<< pool;
- if(pool > 1)
- cout << "-- Result: Oblast";
- else
- cout << "-- Result: Ostrov";
- }
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement