Language: C++

#include <iostream>
#include <string>
using namespace std;
void game(char s[8][8]);
int repcheck(int r,int x,int y,int& si,int& sj,int i,int j,char c,char s[8][8]);
void repcookie(char s[8][8],int ri,int rj,int x,int y,int r,char w);
bool allcheck(char w,char s[8][8]);
int main()
{
	const int size=8;
	char table[size][size];
	string inputbuf;
	for(int i=0;i<size;i++){
		cin >> inputbuf;
		for(int j=0;j<size;j++){
			table[i][j]=inputbuf[j];
		}
	}
	game(table);
	for(int i=0;i<size;i++){
		for(int j=0;j<size;j++){
			cout << table[i][j];
		}
		cout << endl;
	}
	cin.get();
	cin.get();
	return 0;
}
void game(char s[8][8]){
	int irepcookie;
	int si,sj;
	int rx,ry;
	int failc=0;
	bool filled=true;
	while(true){
		si=0;
		sj=0;
		rx=0;
		ry=0;
		irepcookie=0;
		filled = true;
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(s[i][j] == '.'){
					filled = false;
					for(int y=-1;y<=1;y++){
						for(int x=-1;x<=1;x++){
							if(i == 0 && y == -1){break;}
							if(i == 7 && y == 1){break;}
							if(j == 0 && x == -1 || j == 7 && x == 1){
							}else{//
								if(x!=0||y!=0){
									if(s[i+y][j+x]=='o'){
										int repbuf = repcheck(irepcookie,x,y,si,sj,i,j,'x',s);
										if(repbuf>=irepcookie)
											if(irepcookie>0){
												failc=0;
											}
											irepcookie = repbuf;
											rx = x;
											ry = y;
											repbuf = 0;
										}
									}
								}
							}
						}
					}
				}
			}


		}
		if(irepcookie>0){
			s[si][sj] = 'x';
			repcookie(s,si,sj,rx,ry,irepcookie,'x');
		}else{
			failc++;
		}
		if(failc >= 2){
			//break;
		}
		if(filled == true){
			break;
		}
		if(true==allcheck('x',s)){
			break;
		}
		si=0;
		sj=0;
		rx=0;
		ry=0;
		irepcookie=0;
		filled = true;
		for(int i=7;i>=0;i--){
			for(int j=7;j>=0;j--){
				if(s[i][j] == '.'){
					filled = false;
					for(int y=-1;y<=1;y++){
						for(int x=-1;x<=1;x++){
							if(i == 0 && y == -1){break;}
							if(i == 7 && y == 1){break;}
							if(j == 0 && x == -1 || j == 7 && x == 1){
							}else{
								if(x!=0||y!=0){
									if(s[i+y][j+x]=='x'){
										int repbuf=repcheck(irepcookie,x,y,si,sj,i,j,'o',s);
										if(repbuf>=irepcookie){
											if(irepcookie>0){
												failc=0;
											}
											irepcookie = repbuf;
											rx = x;
											ry = y;
											repbuf = 0;
										}
									}
								}
							}
						}
					}
				}
			}
		}
		if(irepcookie>0){
			s[si][sj] = 'o';
			repcookie(s,si,sj,rx,ry,irepcookie,'o');
		}else{
			failc++;
		}
		if(failc >= 2){
			//break;
		}
		if(filled == true){
			break;
		}
		if(true==allcheck('o',s)){
			break;
		}
	}
}
bool allcheck(char w,char s[8][8]){
	char chk;
	bool allc=true;
	if(w=='o'){
		chk = 'x';
	}else{
		chk = 'o';
	}
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(s[i][j]=='o'||s[i][j]=='w'){
			}else{
				allc=false;
				break;
			}
			if(allc==false){
				break;
			}
		}
	}
	if(allc==true){return true;}
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(s[i][j]==w){
				return false;
			}
		}
	}
	return true;
}
int repcheck(int r,int x,int y,int& si,int& sj,int i,int j,char c,char s[8][8]){
	char rep;
	if(c=='x'){
		rep = 'o';
	}else{
		rep = 'x';
	}
	for(int k=1;k<8;k++){
		if(k*y+i<0 || k*y+i >7 || k*x+j <0 || k*x+j >7){return 0;}
		if(s[k*y+i][k*x+j]=='.'){return 0;}
		if(s[k*y+i][k*x+j]==c){
			if(k==1){return 0;}
			if(r<=k-1){
				si = i;
				sj = j;
				return k-1;
			}else if(r>k-1){
				return 0;
			}
		}
	}
	return 0;
}
void repcookie(char s[8][8],int ri,int rj,int x,int y,int r,char w){
	for(int i=1;i<=r;i++){
		s[i*y+ri][i*x+rj] = w;
	}

}

Compiler output:
a.cc: In function 'void game(char (*)[8])':
a.cc:85:25: error: break statement not within loop or switch
   85 |                         break;
      |                         ^~~~~
a.cc:88:25: error: break statement not within loop or switch
   88 |                         break;
      |                         ^~~~~
a.cc:136:25: error: break statement not within loop or switch
  136 |                         break;
      |                         ^~~~~
a.cc:139:25: error: break statement not within loop or switch
  139 |                         break;
      |                         ^~~~~
a.cc: At global scope:
a.cc:142:1: error: expected declaration before '}' token
  142 | }
      | ^