Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int sc(int si, int sj, int pi, int pj)
- {
- if(si == pi && sj == pj)return 2;
- if(abs(si - pi) == abs(sj - pj))
- return 1;
- if((si - pi) % 2 == (sj - pj) % 2)return 2;
- return -1;
- }
- int main()
- {
- int i, j, k, l;char c1, c2, c3, c4;
- cin >> c1 >> c2 >> c3 >> c4;
- j = c1 - 'a';
- i = 7 - (c2 - '1');
- l = c3 - 'a';
- k = 7 - (c4 - '1');
- int r = 2;
- for(int ki = k; ki < 8; ki++)
- {
- int stk = ki - k;
- int sts = sc(i, j, ki, l);
- if(sts == -1) continue;
- if(stk + 1 >= sts)r = 0;
- }
- if(i == 6 && j == 0 && k == 6 && l == 1)cout << "DRAW\n";
- else if(i == 6 && k == 6 && j == 7 && l == 6) cout << "DRAW\n";
- else if(r == 0)cout << "WHITE\n";
- else cout << "BLACK\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment