DEV Community

Palak Hirave
Palak Hirave

Posted on

Day 7 of 100

Today I started off with writing algorithms. I thought of some simple game ideas and broke those down into algorithms. I wrote them on paper before finding draw.io and started to use that instead. Afterwards, I settled on making a hangman game and wrote the algorithm for it before I started building it. First off, I made a list with as many words as I could think of(this took more time than writing the actual program) and then started building the basics. I used for loops to replace the letters in the word with underscores and made a guess variable for the user to guess a letter. If it was in the word, the underscore would be replaced with the letter and if it wasn't the user would either lose a life or if the letter has already been guessed they wouldn't but would be told that they have already guessed it. All this was placed into a while loop that would run until the user guess the word or lost all their lives. Overall, it was quite a fun little project.

Top comments (1)

Collapse
 
aegisspecter profile image
Aegis-Specter

Can you share the code for that hangman game pls