Need help in java

meltyrain

Junior Member
Joined
Jun 30, 2013
Messages
6
Reaction score
0
I have a problem about secret phrase. I like to ask an advice.
I am not sure of what codes to use and I would prefer it simple because I'm new to this stuff so I need to start of basics. :s11: can someone help me?
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
I have a problem about secret phrase. I like to ask an advice.
I am not sure of what codes to use and I would prefer it simple because I'm new to this stuff so I need to start of basics. :s11: can someone help me?

Elaborate on what kind of secret phrase are you referring to ? Does it has anything to do with cryptography ?

There are quite a lot of cryptography related technologies and methodologies, can't help unless you can describe what are you trying to achieve.
 

meltyrain

Junior Member
Joined
Jun 30, 2013
Messages
6
Reaction score
0
no its a guessing game similar to hangman. the user guesses and attempts to guess. displaying a phrase where asterisks are replaced "** ****"(go team)
each time the user guesses the letter,either places the letter in the spot or spots in the phrase and display again, or tell the user its not on the phrase,

congratulatory msg would then be displayed if entire phrase is correct



>.<
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
no its a guessing game similar to hangman. the user guesses and attempts to guess. displaying a phrase where asterisks are replaced "** ****"(go team)
each time the user guesses the letter,either places the letter in the spot or spots in the phrase and display again, or tell the user its not on the phrase,

congratulatory msg would then be displayed if entire phrase is correct

Okay, get it. So this is a console application where one person will be asked to input a string, then you have another person trying to guess by entering one character at a time to reveal the secret string displayed using asterisks for unguessed characters.

Each time a guess is made, one guess opportunity is consumed. If all opportunities are consumed and yet the secret string still isn't fully exposed, the guesser lose.

It's not very hard, you need to think about a few things
1) At any point of time, how do you know if a string is fully uncovered.
2) When a guess is made, how do you determined which part of the string to uncover and how do you represent it ? It can be external variables using arrays, can be done on the string itself, or other methods
3) How do you want to store the secret string ? Do you need to compare between a string that is currently been uncovered to the actual secret string ?

I think it will be wise if you attempt the question in how you understand, without any initial parts from you, it will be hard to start advising. If not, it will be as good as giving you answer, which you will not be learning anything.

If you have doubts, more specific questions, ask them. The idea is you need to be the one doing the handwork, our part is advising based on your understanding, using your codes as a means to guide.
 

mistersatki_

Arch-Supremacy Member
Joined
Sep 29, 2011
Messages
18,432
Reaction score
1,099
easy way is to store the string into an array
then check the input with the array using a loop

though not very efficient but simple to achieve
 

meltyrain

Junior Member
Joined
Jun 30, 2013
Messages
6
Reaction score
0
@davidktw

yes, I need to understand it. thank you so much sir for the advice.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top