Fork Copy #include using namespace std; int board[4][4]; int minScore; int isAllColor(){ int c=board[0][0]; for (int i=0;i<4;i++){ for (int j=0;j<4;j++){ if (board[i][j]!=c) return 0; } } return 1; } int calculate(){ int b=0; int w=0; for (int i=0;i<4;i++){ for (int j=0;j<4;j++){ if (board[i][j]==0) w++; else b++; } } if (b==0 || w==0) return 1; return 0; } void turn(int i, int j){ if (i>3||j>3) return; board[i][j] = 1-board[i][j]; if (i>0) board[i-1][j]=1-board[i-1][j]; if (i<3) board[i+1][j]=1-board[i+1][j]; if (j>0) board[i][j-1]=1-board[i][j-1]; if (j<3) board[i][j+1]=1-board[i][j+1]; } void printBoard(){ for (int i=0;i<4;i++){ for (int j=0;j<4;j++){ cout< minScore) return; // if (step < 3){ // cout<step) minScore = step; return; } if (startX > 3 || startY > 3) return; if (startY == 3) Try(step, startX+1, 0); else Try(step, startX, startY+1); turn(startX, startY); if (startY == 3) Try(step+1, startX+1, 0); else Try(step+1, startX, startY+1); turn(startX, startY); } int main(){ freopen("TurnOverGame.txt","r",stdin); ios::sync_with_stdio(false); int T; cin>>T; for (int tc=1;tc<=T;tc++){ cout<<"Case #"<>tmp; if (tmp=='b') board[i][j]=1; else board[i][j]=0; } } // if (tc!=20) continue; minScore = -1; Try(0, 0, 0); if (minScore !=-1) cout<