?
Solved

tic tac toe array

Posted on 2003-02-26
9
Medium Priority
?
667 Views
Last Modified: 2010-07-27
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
Comment
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
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:Linzer
ID: 8032365
Moderators please remove this homework question and kick the asker's butt.

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

by:Exceter
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

by:bkrahmer
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

Expert Comment

by:cup
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

by:alxnder
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

by:
Exceter earned 260 total points
ID: 8049194
0
 

Author Comment

by:alxnder
ID: 8112292
thank youfor helping me out.
0
 
LVL 8

Expert Comment

by:Exceter
ID: 8112418
You are most welcome.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question