Sonia wrote:[color=blue]
>
> I have come across this solution to a tic tac toe game. It basically checks
> who won the game:
> Is there a better more efficient way of testing if the tic tac toe has been
> won/lost or is over?[/color]
There are various ways, this mess can be be written in a more readable way.
One possible way might eg be, to define an array of possible win situations
and use a loop to inspect, if one of them is present on the board.
BTW: Looking at that code snippet, it seems to me, that you complicated
your program a lot by introducing an overly complicated data structure.
It seems that there are at least 18 variables (2 arrays of 9) to represent
9 fields (where each field can have one of: free, taken_by_player, taken_by_computer)
I would suggest to step back, look at your code from a more global perspective
and decide if it wouldn't be better to change the whole data structure und thus
simplifying all of that mess.
--
Karl Heinz Buchegger
kbuchegg@gascad.at