Welcome to "Guess the Number"! You have to guess the random number between 1-100 generated by the computer. When you take your guess, the computer calculates if your number is higher or lower than the random number and it will decrease the range based on your guess. Try to get the number in the least number of guesses!
The code is exactly 500 characters. I spent most of the time just to cut down the characters so the code format will not be great for reading.
- My code has a validation therefore if user types in invalid inputs, e.g., not a number, number out of range. If the input is invalid, the input will be reprompted.
- My code has a hint: When the player guesses more than 5 times, it gives a hint of the number if its odd or even.
- My code calculates how many times you have guessed and compare it with your best guess which is recorded in a json file.
There were a few times where it had a syntax error: JSON has an unexpected ending. Then I realised that the json file wasn't initialised. I then added {} in the json file and it worked.
I have tried to add audios to the game and they play when users get the answer right or wrong. Even though I have added the bun files but the sound still didn't play, so I gave up on that idea.