Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
* * * * * 1 votes

Java Tutorial: TicTacToe (Revised)

tictactoe java game tutorial

  • Please log in to reply
16 replies to this topic

#13 Polymath

Polymath

    CC Lurker

  • New Member
  • Pip
  • 8 posts

Posted 21 April 2014 - 05:12 PM

I just completed an alternative TicTacToe game (perhaps the one that inspired this tutorial) and i must say, although i like them both, i especially like the color and modified GUI of this one. Quite impressive. My only query is if it is possible to create a user-name for both players and show their scores to the side with their respective scores over a series of games.

 

Anyway thanks.


  • 0

#14 Chall

Chall

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 349 posts
  • Location:Cedar Rapids, IA
  • Programming Language:Java
  • Learning:C, Java, C++, C#, Python, JavaScript, Assembly

Posted 11 May 2014 - 05:17 PM

I just completed an alternative TicTacToe game (perhaps the one that inspired this tutorial) and i must say, although i like them both, i especially like the color and modified GUI of this one. Quite impressive. My only query is if it is possible to create a user-name for both players and show their scores to the side with their respective scores over a series of games.

 

Anyway thanks.

Easily. Shouldn't be too hard. Just make frame a bit bigger, move all the parts that make up the board to the middle, and draw the Strings on the sides of it.


  • 0
Speaks fluent Java

#15 Polymath

Polymath

    CC Lurker

  • New Member
  • Pip
  • 8 posts

Posted 13 May 2014 - 01:46 PM

Easily. Shouldn't be too hard. Just make frame a bit bigger, move all the parts that make up the board to the middle, and draw the Strings on the sides of it.

Thanks, i found another tutorial that does just that.


  • 0

#16 tastan

tastan

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 08 December 2014 - 06:27 PM

hello. I am very new here. will you please explain AI class. In crying need
  • 0

#17 Chall

Chall

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 349 posts
  • Location:Cedar Rapids, IA
  • Programming Language:Java
  • Learning:C, Java, C++, C#, Python, JavaScript, Assembly

Posted 10 December 2014 - 07:24 PM

hello. I am very new here. will you please explain AI class. In crying need

First, it goes through each "win" scenario for itself, to see if any moves this turn will secure it a win. If so, it claims that piece, and moves on.

Otherwise, it then checks if the other player will be able to get a win next move, and secures their win before they can claim it.

If there is no dire need for immediate action, it just takes a random tile (if it's the first move), or picks a random move that will make it possible for the next move after this one to provide it with a win.


Edited by Chall, 10 January 2015 - 05:19 PM.

  • 0
Speaks fluent Java





Also tagged with one or more of these keywords: tictactoe, java, game, tutorial