C
C#

Help a noobie out with a simple hangman

# Help a noobie out with a simple hangman

Jjulia11/20/2023
Hi! New to coding and I need some help to solve this problem. Shall I save the words to a list? Any help appreciated. Thanks!
JJoschi11/20/2023
What did you already do? Do you have a plan or idea how to solve this problem?
Jjulia11/20/2023
This is what I've done so far. Don't have a plan (yet ðŸ¥² )
Jjulia11/20/2023
I figure depending what word Im guessing there is a different outcome
JJoschi11/20/2023
Maybe you could try splitting that game into multiple simple steps and plan accordingly. Don't worry about how to implement those yet. As an example 1. Define the word to guess 2. Define the alphabet permutation to use 3. ??? You already got the first two steps.
Jjulia11/20/2023
Thanks! I figure I could do a for loop that increments over the attempts, with a maximum of 10 attempts
Jjulia11/20/2023
JJoschi11/20/2023
That sounds like a good start. The question now would be. What will happen if the letter is in your word and what if it isn't. Then you basically got it.
Jjulia11/20/2023
Thanks, I think I got it! Almost ðŸ˜„
JJoschi11/20/2023
Looks great. A string is just a collection of chars. So you can itterate over a string like any other collection. You are already doing that. What you need is a way to check if something is a member of a collection.
Jjulia11/20/2023
Thanks alot!
Jjulia11/20/2023
This is my final result
JJoschi11/20/2023
Looks like it should work, did you test it? Good job! A few technical points you could maybe improve if you are interested. Your assignment said, that the guessedWord should not be longer than 16 letters. You could check for that. Connected to that. Your ReadLines show warnings. Maybe you could look at those and adress them. Besides this assignment. Maybe you could try generating the permutation of the alphabet yourself instead of having that as an input? I can also think of a more advanced solution to this problem, in which you wouldn't need to iterate over the string. Do you know what a HashSet is? If not don't worry about it for now!
Jjulia11/20/2023
Yes, I did test it and it worked. Thank you for your input, I will look it up later ðŸ˜„ I do not know what a hashset is I'm on another assignment now and it's far more worse
Jjulia11/20/2023
JJoschi11/20/2023
Just break it down into simple small steps again and then try to implement them. You got the last one without me having to tell you anything.
ZZacharyPatten11/20/2023
Hey I don't have time to read the full context and status of this thread, but I just want to mention that I have an example of a console Hangman game on GitHub if seeing my example may help. If you would like a link to it just ask.
Jjulia11/21/2023
Thank you very much! I got some good help from Joschi. Very kind of you though ðŸ˜„

## Looking for more? Join the community!

C
C#

Help a noobie out with a simple hangman

Join Server