![:lol:](./images/smilies/icon_lol.gif)
Don't know why (str[0][0]==str[1][1]==str[2][2]) was always true
![:x](./images/smilies/icon_mad.gif)
And that was my problem
![:(](./images/smilies/icon_frown.gif)
Can anybody say why?
Thank You.
Moderator: Board moderators
Code: Select all
code removed, thank GOD!
Code: Select all
2
OO.
O..
XXX
XX.
XX.
OOO
no
no
Code: Select all
..X
.XO
XOO
..X
.OX
OOX
..X
O.X
OOX
.XX
OOO
XX.
OOO
XX.
XX.
Code: Select all
if ( X && O ) goto no;
if ( X && (a==b+1) ) goto yes;
if ( X && (a!=b+1) ) goto no;
if ( O && (a==b) ) goto yes;
if ( O && (a!=b) ) goto no;
if ( (a==b) || (a==b+1) ) goto yes; else goto no;
// check out
yes: cout << "yes"; goto end;
no: cout << "no"; goto end;
end: cout << "\n";
Code: Select all
if ( X && O ) goto no;
if ( X && (a==b+1) ) goto yes;
if ( X && (a!=b+1) ) goto no;
if ( O && (a==b) ) goto yes;
if ( O && (a!=b) ) goto no;
if ( (a==b) || (a==b+1) ) goto yes; else goto no;
// check out
yes: cout << "yes"; goto end;
no: cout << "no"; goto end;
end: cout << "\n";
Code: Select all
8
XX.
XX.
OOO
XX.
...
OOO
OX.
OX.
OX.
X..
OXO
OXX
X..
OXO
O.X
XXO
.OX
O..
XXO
.OX
O.X
XXX
X00
...
Code: Select all
no
no
no
yes
no
yes
no
no
Code: Select all
Cut after ACC
Code: Select all
<SNIP>
else if((no==nx)||(nx=no+1))
printf("yes\n");
<SNAP>
I merely used dootzky`s algorithm.. Instead of goto i used a if then else construct to achieve the same effectdootzky wrote:this is how i solved the problem, after 9 WA.
where "bool X" is test for X win, "bool O" is test for O win, "int a" is number of X, and "int b" is number of O.Code: Select all
if ( X && O ) goto no; if ( X && (a==b+1) ) goto yes; if ( X && (a!=b+1) ) goto no; if ( O && (a==b) ) goto yes; if ( O && (a!=b) ) goto no; if ( (a==b) || (a==b+1) ) goto yes; else goto no; // check out yes: cout << "yes"; goto end; no: cout << "no"; goto end; end: cout << "\n";
dootzky