wood burning stoves
The moose likes Beginning Java and the fly likes TicTacToe Game Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "TicTacToe Game" Watch "TicTacToe Game" New topic

TicTacToe Game

doburomirushii nikku
Ranch Hand

Joined: Oct 06, 2004
Posts: 31
OK, Heres the deal. I have my program able to play tictactoe. (Switch turns, Write in the "X" or "O" on the square you pick, and disable the player from picking an already picked square.)

All, I need to do now is make a winning procedure. Now I know I did this before ..(in pascal), but Everytime I write something its not even close to working.

I think you can create some sort of loop the checks one square foe a value and then have it check x+1 for the next square Can anyone give me a hint? If I can dig up that pascal program maybe I can just use that as a model. Thanks.

[ December 08, 2006: Message edited by: doburomirushii nikku ]
Billy Bob

Joined: Feb 05, 2004
Posts: 14
If you go to www.gamedevelopersclub.org, click on Tutorials, there is a tic-tac-toe tutorial on there. It's written in C for the GBA, but the win function is nothing but an if statement. Not very elegant, but it does get the job done, hope it helps.
doburomirushii nikku
Ranch Hand

Joined: Oct 06, 2004
Posts: 31
Ya, thanks. That is exactly what I wanted! I was kinda lookin for it in a loop so I could do 5x5 tic tac toe easier when im done with 3x3. But 3x3 is done so thanks!
Steve Deadsea
Ranch Hand

Joined: Dec 03, 2001
Posts: 125
Here's one I wrote in JavaScript:
I agree. Here's the link: http://aspose.com/file-tools
subject: TicTacToe Game
It's not a secret anymore!