tic tac toe logic

I am creating a tic tac toe program for class. The kicker is that we have to use logic and arithmetic to solve whether the player has won.I am good on the columns and rows but am stumped on the diagonal. I am required to use a 2D char array and cannot hard code it with if statements. Any ideas???
Well, just remember good old Algebra. Remember the functions Y=X and Y=-X, and you should solve the diagonals issue easily. ;)
Last edited on
I see, increment both [][] on a single loop. Thanks.
hey if u want too see the correct tic tac toe C++ code watch here at my post:
http://www.cplusplus.com/forum/general/28977/
He stated that he cannot use hard-coded ifs, which is about the core of your program. Using some simple algebra for this is a lot more efficient (when done right), it also requires an advanced view on this topic - hard coding is a lot below that level.
Topic archived. No new replies allowed.