943,762 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 6925
  • Java RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 6th, 2007
0

Tic Tac Toe help

Expand 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
Similar Threads
Reputation Points: 9
Solved Threads: 0
Newbie Poster
genocide is offline Offline
3 posts
since Jul 2007
Jul 6th, 2007
0

Re: please help me.....

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.
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006
Jul 6th, 2007
0

Re: please help me.....

Click to Expand / Collapse  Quote originally posted by genocide ...
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.
Reputation Points: 85
Solved Threads: 64
Practically a Master Poster
sillyboy is offline Offline
686 posts
since Mar 2007
Jul 6th, 2007
0

Re: please help me.....

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.
Reputation Points: 919
Solved Threads: 354
Nearly a Posting Maven
stultuske is offline Offline
2,487 posts
since Jan 2007
Jul 6th, 2007
0

Re: please help me.....

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.
Reputation Points: 27
Solved Threads: 14
Junior Poster
Cerberus is offline Offline
162 posts
since Sep 2006
Jul 9th, 2007
0

Re: Tic Tac Toe help

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.
Reputation Points: 22
Solved Threads: 10
Junior Poster
TheGathering is offline Offline
102 posts
since Jul 2007
Jul 9th, 2007
0

Re: Tic Tac Toe help

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.
Reputation Points: 22
Solved Threads: 10
Junior Poster
TheGathering is offline Offline
102 posts
since Jul 2007
Jul 9th, 2007
0

Re: Tic Tac Toe help

I think he already left once he found out we wouldn't just hand him a completed assignment to turn in.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 838
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007
Jul 9th, 2007
0

Re: Tic Tac Toe help

Click to Expand / Collapse  Quote originally posted by Ezzaral ...
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.
Reputation Points: 22
Solved Threads: 10
Junior Poster
TheGathering is offline Offline
102 posts
since Jul 2007
Jul 9th, 2007
0

Re: Tic Tac Toe help

I think the connect 4 idea was good anyways. I hope he comes back and tries it.
I agree
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 838
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in Java Forum Timeline: How to implement a binary tree Using HashMap Collection in java
Next Thread in Java Forum Timeline: classes for an online share trading system





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC