Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

The lovely tic tac toe implementation!

Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

author & internet detective
Posts: 39396
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!