DevX Home Today's Headlines   Articles Archive   Tip Bank   Forums

# Thread: Advice on a Tic Tac Toe program needed!!!! (this should be an easy one for the pros out there)

1. EM Guest

## Advice on a Tic Tac Toe program needed!!!! (this should be an easy one for the pros out there)

Hello, I am a student at the University of Akron, majoring in Computer Science.
I currently have an assignment to create a two human player tic tac toe game.
We are using Microsoft Visual C++ version 6.0. I have to create a class TicTacToe
and within that class there needs to be a private data member "board" that
is a 3-by-3 array. I understand how to create the array, but what I need
help with is how to create the two players and test for whether the game
has been won by one of the players of if the game is a draw. If anybody is
able to give me hints as to how I would go about doing this, I would be very
grateful. Thanks for your time!
~Em

2. Vishal Guest

## Re: Advice on a Tic Tac Toe program needed!!!! (this should be an easy one for the pros out there)

Well what u have to do is simple
Allot all 9 boxes such values so that u get the same total when u add
them vertically or horizontally or diagonally(This si the Winning total).
then check for the totals after each move. if the total is the same as the
Winning total the player has won
if want more details i recommend a boook of Artificial intelligence by
Rich

"EM" <ecm4@uakron.edu> wrote:
>
>Hello, I am a student at the University of Akron, majoring in Computer Science.
>I currently have an assignment to create a two human player tic tac toe

game.
>We are using Microsoft Visual C++ version 6.0. I have to create a class

TicTacToe
>and within that class there needs to be a private data member "board" that
>is a 3-by-3 array. I understand how to create the array, but what I need
>help with is how to create the two players and test for whether the game
>has been won by one of the players of if the game is a draw. If anybody

is
>able to give me hints as to how I would go about doing this, I would be

very
>grateful. Thanks for your time!
> ~Em

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 FAQ Latest Articles Java .NET XML Database Enterprise
 Questions? Contact us. C++ Web Development Wireless Latest Tips Open Source

×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.