Create a one player number guessing game
- Clone this repo!
- Change the remote!
- Edit the
main.js
. - You are creating a guessing game. Some elements of the game are already written, but poorly!
- When the player initiates a game, the computer should pick a random (whole) number between 0 - 100.
- As the player guesses, the computer should let the player know if they should guess higher or lower.
- When the player guesses the number, the computer should congratulate them and ask if they want to play again.
- If the player chooses to play again, the game should reset, and the computer should choose a new number.
- Create a stylesheet to make your game pretty (but only after your game works)!
There are some notes for you in the
main.js
file
A link to a repo containing at least:
index.html
main.js
style.css
- Allow the user to select a range of numbers between which to guess.
- Have the computer keep track of how many turns it took the player to guess the number. Tell the player how many turns it took them to guess after they have won.
- Minimize the actual logic in any of your functions (including the
guessingGame
) by breaking your code into smaller chunks. Try to make as much of the code as modular as possible - this means finding patterns and re-using code whenever possible. - Try to refactor your code so that your functions have return values, and no side effects. You won't be able to completely remove side effects, but see how close you can get.
- Write a blog about about why some variables are declared outside the guessingGame function, and why that could be a useful or harmful thing
Sometimes, if you just add a(nother) parameter to a function, you can use it for two different, but similar situations.