Take a look at his code....
What does it do?
Look at the program and see if you were right!
Using the skills we have looked at so far, see if you can complete the following challenges...
In the example code above, the mole only appears in 1 one 3 of the holes.
Adapt the program above so that the mole will appear randomly in 1 of 5 holes.
Adapt the program so that instead of waiting 1 second before appearing and 1 second before disappearing, it waits a random time between 0.2 seconds and 1.4 seconds.
Adapt the program so that instead of repeating 10 times, it repeats until you have whacked 10 moles (i.e. the score is 10).
Create a program that:
Adapt the program so that it will ask them 10 different questions.
Every time they get a question right, they should get a point.
At the end of the program, give them a score out of 10.
Don’t forget to initialise the score at the beginning of the program.
You are going to create a guessing game.
Maths Man should think of a random number between 1 and 100 and store it in a variable.
Maths Man will then ask you to guess what the number is.
Maths man should count each time you make a guess.
Maths Man should then tell you if your guess is too big, or too small.
If you didn’t guess correctly, Maths Man should then ask you to guess again.
If you guessed correctly, Maths Man should say well done, then tell you how many guesses it took.
Create a program the program so it works as described above.
Adapt the program so that is will ask you if you want to play again.
Adapt the program so that it keeps a record of the lowest number of guesses taken to guess the number.
If the player takes less guesses than the current lowest number, then is should say well done and update the lowest score!