/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: main.cpp * Author: cteam014 * * Created on October 20, 2018, 11:01 AM */ #include #include using namespace std; /* * */ class Pos { public: int x; int y; bool operator == ( Pos other ) { return (other.x == this->x && other.y == this->y ) ; } Pos(int x, int y) { this->x = x; this->y = y; } bool isNotValid ( ) { return !( 1 <= x && x <= 8 && 1 <= y && y <= 8 ); } bool operator < (const Pos & other ) const { if ( this->x < other .x ) { return true ; } else if ( this->y < other . y ) { return true ; } else return false ; } // par 1-8 Pos move(int to) { switch (to) { case 1: return Pos(x + 1, y - 2); case 2: return Pos(x + 2, y - 1); case 3: return Pos(x + 2, y + 1); case 4: return Pos(x + 1, y + 2); case 5: return Pos(x - 1 , y + 2); case 6: return Pos(x - 2, y + 1 ); case 7: return Pos(x -2 , y - 1); default: case 8: return Pos(x - 1 , y - 2 ); } } }; set > eval ; int white = 0 ; int black = 0 ; void execute ( Pos a , Pos b , char type ) { if ( eval.insert( make_pair ( a , b ) ).second == false ) return ; if ( a.isNotValid() || b.isNotValid() ) { return ; } if ( a == b ) { if ( type == 'b' ) { ++ white ; } else { ++ black ; } return ; } if ( type == 'b' ) { for ( int i = 1 ; i <= 8 ; ++ i ) execute ( a , b.move( i ) , 'w') ; } else { for ( int i = 1 ; i <= 8 ; ++ i ) execute ( a , b.move( i ) , 'b') ; } } int main(int argc, char** argv) { int x , y ; cin >> x >> y ; Pos a ( x, y ); cin >> x >> y ; Pos b ( x , y ); execute ( a , b , 'w' ) ; double probW = white / (double) ( white + black ) ; double probB = black / (double) ( white + black ) ; if ( abs ( probB - probW ) <= 1E-6 ){ cout << "draw" << endl ; } else if ( probW > probB ) { cout << "white" << endl ; } else { cout << "black" << endl ; } return 0; }