Hi All,
i was making "tictac toe" a famous game.
i made it but the following portion of the prog although it works but it does
not seems good to me.
i wonder if i can do it with some loops or something else...
// checking if any player has entered a winning combination
// this code cheks all 8 winning combinations!
//but i wud like to know if i can do it with some alternative way
//2D array name "tictac[][]"
if (tictac[0][0]==tictac[0][1] && tictac[0][1]==tictac[0][2])
flag=tictac[0][0];
else if (tictac[1][0]==tictac[1][1] && tictac[1][1]==tictac[1][2])
flag=tictac[1][0];
else if (tictac[2][0]==tictac[2][1] && tictac[2][1]==tictac[2][2])
flag=tictac[2][0];
else if (tictac[0][0]==tictac[1][0] && tictac[1][0]==tictac[2][0])
flag=tictac[0][0];
else if (tictac[0][1]==tictac[1][1] && tictac[1][1]==tictac[2][1])
flag=tictac[0][1];
else if (tictac[0][2]==tictac[1][2] && tictac[1][2]==tictac[2][2])
flag=tictac[0][0];
else if (tictac[0][0]==tictac[1][1] && tictac[1][1]==tictac[2][2])
flag=tictac[0][0];
else if(tictac[2][0]==tictac[1][1] && tictac[1][1]==tictac[0][2])
flag=tictac[2][0];
Thanx in Advance!!
Asad Abbas
UET Taxila
Pakistan
--------------------------------------------------------------------------------
One of the main causes of the fall of the Roman Empire was that, lacking zero,
they had no way to indicate successful termination of their C programs.
Robert Firth
[Non-text portions of this message have been removed]