#include #include #include #define N 8 using namespace std; double white_now[N][N]; double black_now[N][N]; int possible_moves[N][N]; double white_prob = 0; double black_prob = 0; bool inworld(int x) { return x >= 0 && x < 8; } bool inworld(int x, int y) { return inworld(x) && inworld(y); } int count_positions(int x, int y) { int count = 0; if (inworld(x + 1) && inworld(y + 2)) ++count; if (inworld(x + 2) && inworld(y + 1)) ++count; if (inworld(x + 2) && inworld(y - 1)) ++count; if (inworld(x + 1) && inworld(y - 2)) ++count; if (inworld(x - 1) && inworld(y - 2)) ++count; if (inworld(x - 2) && inworld(y - 1)) ++count; if (inworld(x -2) && inworld(y + 1)) ++count; if (inworld(x - 1) && inworld(y + 2)) ++count; return count; } void count_possible_moves() { for (int y = 0; y= 8 || y < 0 || y >= 8) { return; } if (inworld(x + 1) && inworld(y + 2)) array[x+1][y+2] += prob; if (inworld(x + 2) && inworld(y + 1)) array[x+2][y+1] += prob; if (inworld(x + 2) && inworld(y - 1)) array[x+2][y-1] += prob; if (inworld(x + 1) && inworld(y - 2)) array[x+1][y-2] += prob; if (inworld(x - 1) && inworld(y - 2)) array[x-1][y-2] += prob; if (inworld(x - 2) && inworld(y - 1)) array[x-2][y-1] += prob; if (inworld(x -2) && inworld(y + 1)) array[x-2][y+1] += prob; if (inworld(x - 1) && inworld(y + 2)) array[x-1][y+2] += prob; } void step(double now[8][8]) { double next[N][N]; set_to_zero(next); for (int y = 0; y black_prob) { cout << "white\n"; } else { cout << "black\n"; } return 0; }