
-----------------------------------
Cancer Sol
Sat Mar 16, 2013 2:54 pm

Tic Tac Toe game
-----------------------------------
Okay so... I'm going to make a tic tac toe game through a console application. It's going to be a 2-player game (no A.I.'s).
What I'd like to know is: How do I clear the whole console screen? Or draw black on the whole game, so it's basically cleared?
Every time the game has to draw a new game board, I'm going clear the screen.

I'm also wondering, how do I use a loop for the game board but also show the new values on the board?
The board will look like:
[code]
1|2|3
-+-+-
4|5|6
-+-+-
7|8|9
//Basically, it looks like Al's Tic Tac Toe game board :P
[/code]
So far, if I do a loop, the board will always look the same. How do I make it so that if player 1 choose to mark an "x" at number 5, then then the screen clears, the board will appear again with 5 replaced as x? Hopefully, it'll stay there each time the screen clears though :/
So far, that's the only thing I think I need help with, and credits to Al for making his Tic Tac Toe game so I kinda know how to start it :P

-----------------------------------
Insectoid
Sat Mar 16, 2013 3:46 pm

RE:Tic Tac Toe game
-----------------------------------
Clearing the screen in any traditional way will break cross-platform compatibility. You could just write a whole bunch of empty lines so that the old board scrolls up out of view and then draw the new one. 

How do I make it so that if player 1 choose to mark an "x" at number 5, then then the screen clears, the board will appear again with 5 replaced as x

This will be very, very easy to do once you have the game actually working. I say this because if you can't figure this out, then your game probably doesn't work anyway. It's a problem that solves itself, really.

-----------------------------------
Cancer Sol
Sat Mar 16, 2013 3:52 pm

Re: RE:Tic Tac Toe game
-----------------------------------
Clearing the screen in any traditional way will break cross-platform compatibility. You could just write a whole bunch of empty lines so that the old board scrolls up out of view and then draw the new one. 

How do I make it so that if player 1 choose to mark an "x" at number 5, then then the screen clears, the board will appear again with 5 replaced as x

This will be very, very easy to do once you have the game actually working. I say this because if you can't figure this out, then your game probably doesn't work anyway. It's a problem that solves itself, really.

Well so far, I think I remember seeing someone saying that if I input another value at number 5, for example, then the old value would be removed, and the variable would have the new value that was inputed. I'll try that to see if it'll work :P

Edit: It worked! I know how to do that part then :P

So far, I was only trying to output this text based picture:

#include 
using namespace std;

void clearscreen ()
{
    cout 