permaculture playing cards*
The moose likes Beginning Java and the fly likes The lovely tic tac toe implementation! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "The lovely tic tac toe implementation!" Watch "The lovely tic tac toe implementation!" New topic
Author

The lovely tic tac toe implementation!

Mike Smith
Ranch Hand

Joined: Sep 23, 2005
Posts: 85
Hello, I am now on the finally tic tac toe implementation. I am to make a gui tic tac toe game. I am having a little problem with getting my program to display who has won the game. Right now the program is saying the game has resulted in a tie(it does this all the time). It does work properly besides that part I believe. It determines if a move is invalid if a square is occupied etc... If someone could point me where I am off this would greatly help me out. Thanks again

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30124
    
150

Mike,
Two things:
1) I don't see anywhere where you set won to true. Can you point to the part of the code that does that? Or if it isn't implemented, can you describe how you know the game is won?

2) You should reverse the order of the following two if statements. It is valid for the board to be full and have someone still win. For example, if X moves 5 times and O moves 4 times and X wins on the fifth move.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The lovely tic tac toe implementation!
 
Similar Threads
Calling the repaint() method
Turn Based Strategy Games
Canvas object not appearing
TicTacToe in Java
Converting an Application into JApplet