Tic Tac Toe help

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Closed Thread

Join Date: Jul 2007
Posts: 3
Reputation: genocide is an unknown quantity at this point 
Solved Threads: 0
genocide genocide is offline Offline
Newbie Poster

Tic Tac Toe help

 
0
  #1
Jul 6th, 2007
hi guys.. i need help.. can you give me a simple program of games in java except for tic-tac toe? i need it at the end of july.. i want to pass this subject and i want to master this programming language... please do grant my request... thank you very much
Quick reply to this message  
Join Date: Feb 2006
Posts: 2,413
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 256
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: please help me.....

 
0
  #2
Jul 6th, 2007
Do your own homework. You have a month, do it. God, asking for someone to do your work for you, then saying, in the same breath no less, that you want to master the language. Well, buddy, those two statements just do not go together.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Quick reply to this message  
Join Date: Mar 2007
Posts: 686
Reputation: sillyboy is on a distinguished road 
Solved Threads: 61
sillyboy's Avatar
sillyboy sillyboy is offline Offline
Practically a Master Poster

Re: please help me.....

 
0
  #3
Jul 6th, 2007
Originally Posted by genocide View Post
hi guys.. i need help.. can you give me a simple program of games in java except for tic-tac toe? i need it at the end of july.. i want to pass this subject and i want to master this programming language... please do grant my request... thank you very much
If somebody writes the game for you, it is going to work adversly towards your mastering of the language. Google would be a good place to start, and not just the first results page.
Quick reply to this message  
Join Date: Jan 2007
Posts: 706
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 84
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: please help me.....

 
0
  #4
Jul 6th, 2007
since you are taking the subject, you'll propably have examples in your textbook or a course. try to understand what they do, create alternative sollutions, ...
this is a better (and faster) way to learn java than asking someone you don't know and who'll propably use code you don't understand to make it for you.

just choose for yourself what kind of program you want, decide on the classes, make them and use them. even if the program isn't completed at the end of the month, at least your teacher will see you've given it some effort.
Quick reply to this message  
Join Date: Sep 2006
Posts: 162
Reputation: Cerberus is an unknown quantity at this point 
Solved Threads: 14
Cerberus Cerberus is offline Offline
Junior Poster

Re: please help me.....

 
0
  #5
Jul 6th, 2007
How about a simple card game like blackjack!

Make a class called card and initialize each one putting them into a container like a list. You could then implement an algorithm to shuffle the cards too.
Quick reply to this message  
Join Date: Jul 2007
Posts: 102
Reputation: TheGathering is an unknown quantity at this point 
Solved Threads: 10
TheGathering's Avatar
TheGathering TheGathering is offline Offline
Junior Poster

Re: Tic Tac Toe help

 
0
  #6
Jul 9th, 2007
I wrote a tic-tac-toe program in about an hour for AP Computer Science. In a week we wrote a fully functional monopoly. (just to give you an idea of what a month can do)

Suggestion for implementation of a tic-tac-toe program:

Make a grid of buttons with transparent .gifs via loop(using gridbag or something to make the 3x3 grid) and place them into a two dimensional array (or populate a two dimensional array with a small class representing the buttons). The buttonclick method could then replace the button being clicked with either an x or an o .gif, then call a method to check for 3 of the same .gifs (or flag variables in the classes) in a row in the various directions. Once one of the players wins, display a win message and disable the buttons.



The one that I wrote was 3 classes and totaled only 340 lines including the gui. A tic-tac-toe program shouldn't take you very long at all to write, so knock it out early and enjoy your month :p
Last edited by TheGathering; Jul 9th, 2007 at 10:59 am.
Quick reply to this message  
Join Date: Jul 2007
Posts: 102
Reputation: TheGathering is an unknown quantity at this point 
Solved Threads: 10
TheGathering's Avatar
TheGathering TheGathering is offline Offline
Junior Poster

Re: Tic Tac Toe help

 
0
  #7
Jul 9th, 2007
Whoops, missed the part with "except" on the tic tac toe idea. :p

Connect 4 is an easy game that can be done with an expanded version of the "Suggestion for implementation of a tic-tac-toe program:" above with the addition of a timer and using only a single row of actual buttons.


Monopoly is an easy game to write if you keep it basic, though requires lots of gui code, which can take time to work through if you get something wrong.

If you don't like guis and prefer algorithms, you can try Tetris (friend of mine wrote one in about a week and a half) or simple card games as stated above.
Quick reply to this message  
Join Date: May 2007
Posts: 4,479
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 514
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Tic Tac Toe help

 
0
  #8
Jul 9th, 2007
I think he already left once he found out we wouldn't just hand him a completed assignment to turn in.
Quick reply to this message  
Join Date: Jul 2007
Posts: 102
Reputation: TheGathering is an unknown quantity at this point 
Solved Threads: 10
TheGathering's Avatar
TheGathering TheGathering is offline Offline
Junior Poster

Re: Tic Tac Toe help

 
0
  #9
Jul 9th, 2007
Originally Posted by Ezzaral View Post
I think he already left once he found out we wouldn't just hand him a completed assignment to turn in.

He still has 26 days before he realizes no-one else will give him a completed assignment either. :p

I think the connect 4 idea was good anyways. I hope he comes back and tries it.
Quick reply to this message  
Join Date: May 2007
Posts: 4,479
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 514
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Tic Tac Toe help

 
0
  #10
Jul 9th, 2007
Originally Posted by TheGathering View Post
I think the connect 4 idea was good anyways. I hope he comes back and tries it.
I agree
Quick reply to this message  
Closed Thread

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC