Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bit of a challenge - Tic Tac Toe

Status
Not open for further replies.

Gorthon

Programmer
May 16, 2001
1
0
0
AU
I've been trying to teach myself C. I found an excercise on the net where you had to complete a small tic tac toe game... I've tried a few things but can never complete it. I'm sure it would be fairly easy for someone a little more competent, but for the meantime I'd like to see how some of you would do it (try to keep it basic please) just to give me an idea on flow, etc.

I've placed a link to the c file below. If someone could take 10 minutes out to look it would be greatly appreciated. Thanks

 
hi, downloaded and read the coding for the above, I am afraid it is above my level of understanding at the moment. But I have mailed you my coding for a similar game of tictactoe. Without reference to structs and a like. This coding may help with your problem, as there maybe snippets in there you could use. Hoping to get certified..in C programming.
 
Hi,
I don't have the patience to explain the whole code but the code is very straight forward and easy to understand.

There are many different ways to do the same thing.

If you tell us which part you did not understand then it would be easier to help you.

Regarding the struct - its to hold the information of the board which is generally a picture of a board.

Try to do tic-tac-toe with only functions without worrying about structs - write the algorithm first it will solve 75% of you problem

An idea of what steps to follow :-

Step 1 :- Show the board and etc and instruction as to what to do - etc
Step 2 :- Refresh the screen every time player makes a move
step 3 :- Check if the user has won the game every time player makes a move.

One can write these steps much better probably - I wrote to give you a rough idea - its very crude though.

Try using arrays(1 dimesnional) - its possible.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top