• C

tic tac toe array

Write a program to allow two users to play tic tac toe.  Use a 3x3 array to store values of 0, 1, -3 for X, O, blank. A function included to print out the gameboard.  Do no tdetermine winner. Gameboard look something like this:  
1   2   3
X   X   O  1
O   X   O  2
X   O   X  3
Enter row (0 to quit):
Enter column:
Entering a 0 for the row number at any time should allow the user to quit, and X always goes first.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Moderators please remove this homework question and kick the asker's butt.



Well, I don't mean the part about kicking - maybe I'm getting bored, that's all - but EE's rule is that you have to think by yourself about your problem, and then you can ask for advice on specific points. And we'll be glad to help!

Good luck,
>> but EE's rule is that you have to think by yourself about your problem

True, but EE has another policy that prohibits flaming. :-)

That's a strange way of ordering the array indices.  :)  I usually order them on the cartesian coordinate system.  The Y values here are backwards.  Not to mention that even though they're logically 1-3, they'd be 0-2 in an array (hint!).  Feel free to run a complete psuedocode breakdown of the problem by us if you'd like.  Or let us know exactly what you don't understand.  I'm sure your teacher gave you enough background to solve the problem.
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

alxnderAuthor Commented:
okay then I will inform you with a specific part when I get stuck. Thank you.
You could also do it as a 1-D array which is a lot easier to pass round, store and examine.  Use index % 3 for the column.
alxnderAuthor Commented:
I got the program to work but I was wondering how do I determine a winner for each game?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alxnderAuthor Commented:
thank youfor helping me out.
You are most welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.