#include #include #include #include #include #include #include #include #include #include using namespace std; double global_w = 0; double global_b = 0; vector x_pos(8); vector y_pos(8); void dfs(pair white_pos, pair black_pos, vector > b, double p, int move){ pair x_y = move ==1 ? white_pos : black_pos; int pos = b[x_y.first][x_y.second]; int n =0; for(int i =0; i< 8; i++) { if(x_y.first+x_pos[i] < 8 && x_y.second+y_pos[i] < 8 && x_y.first+x_pos[i] >=0 && x_y.second+y_pos[i] >= 0) { n++; } } if (!n) return; double cur_p = p/(double)n; //printf("%lf.7\n",cur_p); if(cur_p < 0.000001) { return; } if(pos == 1 && move == 2 && white_pos.first != x_y.first && white_pos.second!= x_y.second) { global_b += p; return; } b[x_y.first][x_y.second] = move; if(pos == 2 && move == 1 && black_pos.first != x_y.first && black_pos.second!= x_y.second) { global_w += p; return; } for(int i =0; i< 8; i++) { if(x_y.first+x_pos[i] < 8 && x_y.second+y_pos[i] < 8 && x_y.first+x_pos[i] >=0 && x_y.second+y_pos[i] >= 0) { pair new_pos(x_y.first+ x_pos[i],x_y.second+y_pos[i]); dfs(move ==1 ? new_pos : white_pos, move ==2 ? new_pos:black_pos,b,cur_p, move == 1 ? 2 : 1); } } } int main() { x_pos[0] = 1; x_pos[1] = 1; x_pos[2] = -1; x_pos[3] = -1; x_pos[4] = 2; x_pos[5] = -2; x_pos[6] = 2; x_pos[7] = -2; y_pos[4] = 1; y_pos[5] = 1; y_pos[6] = -1; y_pos[7] = -1; y_pos[0] = 2; y_pos[1] = -2; y_pos[2] = 2; y_pos[3] = -2; int a,b; cin >> a >> b; int c,d; cin >> c >>d; vector > board(8,vector(8,0)); board[a-1][b-1] = 1; board[c-1][d-1] = 2; dfs(make_pair(a-1,b-1), make_pair(c-1,d-1), board, 1,1); // cout << global_w << " " << global_b; if(abs(global_w - global_b) < 0.000001) { cout << "draw\n"; } else if (global_b > global_w) { cout << "black\n"; }else { cout << "white\n"; } }