Solved

tic tac toe array

Posted on 2003-02-26
Medium Priority
667 Views
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.
0
Question by:alxnder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 1

Expert Comment

ID: 8032365

Thanks.

------------------------------------

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,
Linzer
0

LVL 8

Expert Comment

ID: 8034953
>> but EE's rule is that you have to think by yourself about your problem

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

Exceter
0

LVL 2

Expert Comment

ID: 8039402
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.
brian
0

Author Comment

ID: 8040131
okay then I will inform you with a specific part when I get stuck. Thank you.
0

LVL 11

Expert Comment

ID: 8040286
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.
0

Author Comment

ID: 8049155
I got the program to work but I was wondering how do I determine a winner for each game?
0

LVL 8

Accepted Solution

Exceter earned 260 total points
ID: 8049194
0

Author Comment

ID: 8112292
thank youfor helping me out.
0

LVL 8

Expert Comment

ID: 8112418
You are most welcome.
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: Iâ€™ve never triâ€¦
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ouâ€¦
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Suggested Courses
Course of the Month9 days, 15 hours left to enroll