Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 670
  • Last Modified:

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.
0
alxnder
Asked:
alxnder
1 Solution
 
LinzerCommented:
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
 
ExceterCommented:
>> 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
 
bkrahmerCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
alxnderAuthor Commented:
okay then I will inform you with a specific part when I get stuck. Thank you.
0
 
cupCommented:
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
 
alxnderAuthor Commented:
I got the program to work but I was wondering how do I determine a winner for each game?
0
 
alxnderAuthor Commented:
thank youfor helping me out.
0
 
ExceterCommented:
You are most welcome.
0

Featured Post

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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now