String Conversion to Char for Java Game

Posted by Jen on Game Development See other posts from Game Development or by Jen
Published on 2012-11-27T12:07:46Z Indexed on 2012/11/27 17:22 UTC
Read the original article Hit count: 220

Filed under:

Is there someone who could help me achieve the following points on this problems? I can't seem to get it. I tried using toCharArray and Scanner to achieve this, but it doesn't work, nor do I know how to make this things possible for my word game. :(

· Get a popular name of person, place, verse, saying or event from the user. This may have a single or multiple words in it.

· Create a copy of this string to an array where each letter is replaced with a hyphen (-) and each space is replaced with an underscore (_). Symbols and numbers will remain shown.

· The program then asks a letter from the user. If the letter is in the inputted string, then it should be shown on the array at the same position it is shown in the string. Meaning, the letter replaces the hyphen (-) at the correct position of the array.

· The program again prompts for a letter from the user and replaces the hyphen (-) of the array if it exists on the inputted string. This will be repeatedly done until such time each hyphen (-) is replaced with the correct letter.

· If the user inputs an invalid letter, that is, a letter that does not exist on the inputted string, then the program should inform the user. If this happens 3 times while there is still at least one hyphen on the array, then the program should inform the user that he lost the game and showing him the whole correct string.

· If the user completes the game, meaning, all hyphens have been replaced with the correct letters; then the program should congratulate the user for a job well done.

© Game Development or respective owner

Related posts about java