Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2005

Tip: Looking for answers? Try searching our database.

hangman

Thread view: 
Salim - 07 Mar 2005 18:11 GMT
Hey guys, I'm new to j2me and I would like to develop a hangman game
are there any tutorials available online to tech me specifically how to
do this.

Salim
SMC - 08 Mar 2005 00:41 GMT
> Hey guys, I'm new to j2me and I would like to develop a hangman game are
> there any tutorials available online to tech me specifically how to do
> this.
>
> Salim

I'll lay it out for you:

You take a given word (maybe when you start the program it accepts the
word as input)

The main program is a simple loop of accepting guesses until either the
user runs out of guesses (is hung) or guesses all the correct letters.

In the loop:

You accept a character as a guess
If the character exists in the word
   show it was a correct guess
   (display the character within hidden word for example)
else
   decrease the number of guesses
   (display part of the gallows if desired)

I did a solution in about 15 minutes. I read the word into an array of
char. I had another array of char of the same length which shows the
progressively revealed word (e.g. if the word was "hello" then it
initially displayed as "-----". If the person chose the letter "l" then it
became "--ll-".) When I check a guess, I simply look for the guessed
character in the first array of char (by looping over it) and in each
location I found it, I'd note the index and update the 2nd array of char
with the (correctly) guessed character at the same index. When the two
arrays are equal, then the game is finished (if you haven't run out of
guesses first).

Make an attempt and post it if you want more help.

Cheers
Signature

Sean

"I love deadlines. I love the sound they make as they Whoosh by" -
Douglas Adams

Hal Rosser - 08 Mar 2005 01:57 GMT
--------
       |
      O
     /|\
     /\

> Hey guys, I'm new to j2me and I would like to develop a hangman game
> are there any tutorials available online to tech me specifically how to
> do this.
>
> Salim
Fahd Shariff - 08 Mar 2005 09:58 GMT
I think Salim wanted some pointers on developing this as a J2ME
application. I'm sure he could have handled the implementation of the
hangman game himself.

Signature

Fahd Shariff
"Let the code do the talking... "

Salim - 10 Mar 2005 11:36 GMT
Yes Fahd, Exactly that, thats why i'm asking if there are any
tutorials to give me a few pointers and teach me at the same time.

I'M NOT ASKING TO BE 'SPOON FED'!!!!!

Salim

> I think Salim wanted some pointers on developing this as a J2ME
> application. I'm sure he could have handled the implementation of the
> hangman game himself.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.