Sign in to follow this  

Tic Tac Toe with C++?

This topic is 4842 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been pondering weather to attempt to make Tic Tac Toe in C++. I just don't know how to update the board without having to print it out again using cout.Is there a way to update it without printing the whole board out again? -Thanks

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yeah, just use SetConsoleCursorPosition to write to the same locations on your console window. Here's a link that describes the function

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setconsolecursorposition.asp

TTT is easy so it shouldn't be too hard to complete, Good luck!

Share this post


Link to post
Share on other sites
Sure.

Similarly, for Linux/BSD/etc., look into the "curses" and "ncurses" libraries.

On the other hand, re-outputting the board is not that difficult. You should have some data structure that represents the board "state" (i.e. stores whether there's an X or O or blank space at each spot), and pass that to a function, which takes the data and outputs the corresponding board.

Share this post


Link to post
Share on other sites

This topic is 4842 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this