I'm making a tic-tac-toe game, and I'm trying to develop a function that draws the game to the screen, but the amount of if statements just keeps going up, and I don't know what I'm going to do when I need to draw more than two x's and o's! Please help me.
^ Curses? I don't know how to install that, and can't seem to find a decent tutorial. I'd like to write a 'smart' function, or maybe a class, but it just seems that I can't develop a good algorithm or something.
Dear Lord, there is a much more concise way to write it. I think this is stemming from you storing the x's and o's improperly as well. Is a single integer variable x storing all the locations of x's on the board?
Store each board location in array, with 3 different possible values, one for empty, one for X, one for O.
You don't need to draw an entire row at once, you can do it one at a time. First check the first square, and draw what needs to be drawn there. Then draw a '|', then check the next square what needs to be drawn there.
Hint: The final solution is most likely going to involve 2 for loops and 2 if-else statements.