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!
No description
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 🥲 )
No description
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
No description
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 😄
No description
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
No description
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
No description
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
Want results from more Discord servers?
Add your server
Recommended Posts
C# Image Resizing on Visual Studio CodeI've tried both ``newPic.SizeMode = PictureBoxSizeMode.StretchImage;`` and ``newPic.SizeMode = PictuI'm stuck,visual studio 22, I need help making my invaders/enemies move left to right then downI’m trying to get my invaders/enemies to move left to right then down like in the game space invader✅ Where should I store all the sensitive file on .NET project?Hello everyone, May I know where should I store all the credential files that needs to be used by .Unity CodeI have been trying to get my C# code to work in unity for about a week and I am officially lost. I'vHelp! Reporting service in dotnet Core?please don't mind my english, it is not that good. i have created 2 projects one is server -dotnetCatAPI Json deserialization issue.I'm having trouble getting my code to deserialize my json correctly. When I run my Program.cs I get ✅ Any idea why I cant use sendkey?Authorization in microservices archHello everyone, I'm quite new to the NET microservices arhitecture and right now I'm implementing a.✅ I can't get my runButton button to work on a windows form app```cs if (e.KeyCode == Keys.Enter || (e.Modifiers == Keys.None && sender == runButton)) ``` I can sGit and Google Drivenew git user.. it seems to have your local repositories in a google drive controlled file structure ASP.NET CRUD MODALI created a MVC controller with actions (CRUD) and I would like to know, how to modify this pre geneError✅ using from another csprojCurrently i have 2 projects, an api app and a worker service app And both use the same models. Is thJavascript not working on my MVC projectI'm learning front end tutorials at the moment so I'm totally new to designing websites. _Layout.csis there a way to get the colocation center connected to with C# ?I wanna get information about the colocation center exactly how Cloudflare warp gets it in the prefexaml and x:Class - issue (CS1061)I got a project wich some of you helped me with allready, tho there is still one issue I coudn't resCan't fire click blazor ui button```cs @page "/members" @namespace Blazor.Web @attribute [StreamRendering] <PageTitle>Members</PageTHelp Minecraft Console Client scripting(https://github.com/MCCTeam/Minecraft-Console-Client Link to MCC) is there a way to make a C# scrip✅ Bypass ASP.NET Required authenticatorIm trying to return Forbid (403) to the user if a resource already exists it all works fine but the Issues trying to create new error typesHello everyone. I'm trying to create my own extensible error type, based on the RFC 7807. ```c# pu