Home > Back-end >  C of renju problem, what's in place? Ask for help...
C of renju problem, what's in place? Ask for help...

Time:10-24

# include
using namespace std;
Void init (char a [20] [20]);
Void the draw (char b [20] [20]);
Int test (char c [20] [20], char);
Int check (int, int);
Int main ()
{
Char d [20] [20].
int i,j;
for(i=0; i<20; I++)
for(j=0; j<20; J++)
{
D [I] [j]='|';
cout<" - ";
cout}
For (int x=0; x<900;)
{
int i,j;
If (x % 2==0)
{
coutcin> I> j;
If (check (I, j))
{
coutcin> I> j;
}
[I] [j] if (d=='X' | | d [I] [j]=='O')
{
cout<" Here already, please enter again: ";
cin> I> j;
}
D [I] [j]='X';
The draw (d);
If (test (d, 'X'))
{
Char replay.
coutcin> Replay.
If ((replay=='y') | | (replay=='y'))
The main ();
The else
cout}
X +=1;
}
The else
{
coutcin> I> j;
If (check (I, j))
{
coutcin> I> j;
}
[I] [j] if (d=='X' | | d [I] [j]=='O')
{
cout<" Here already, please enter again: ";
cin> I> j;
}
D [I] [j]='O';
The draw (d);
If (test (d, 'O'))
{
Char replay.
coutcin> Replay.
If ((replay=='y') | | (replay=='y'))
The main ();
The else
cout}
X +=1;
}
}
return 0;
}
Void the draw (char b [20] [20])
{
for(int i=0; i<20; I++)
for(int j=0; j<20; J++)
{
cout<" - ";
cout}
}
Int check (int x, int y)
{
If (x<0 | | x> 20 | | y<0 | | y> 20)
return 1;
The else
return 0;
}
Int test (char c [20] [20], char z)
{
int i,j;
for(i=0; i<15. I++)
for(j=0; j<15. J++)
If ((z==c [I] [j] & amp; & Z==c + 1] [I [m + 1] & amp; & Z==c/I + 2 + 2 [j] & amp; & Z==c/I + 3, + 3 [j] & amp; & Z==c/I + 4 + 4 [j]) | |
(z==c [I] [j] & amp; & Z==c + 1] [I [j] & amp; & Z==c + 2] [I [j] & amp; & Z==c + 3 [I] [j] & amp; & Z==c + 4] [I [j]) | |
(z==c [I] [j] & amp; & Z==c [I] [m + 1] & amp; & Z==c + 2 [j] [I] & amp; & Z==c + 3 [j] [I] & amp; & Z==c + 4 [j] [I]))
return 1;
The else
return 0;
}








CodePudding user response:

What's the problem?

CodePudding user response:

Unable to determine winning!
  • Related