2016-03-26 00:47:20 +01:00
# guess the number challenges
Coding challenges for the guess the number tutorial.
## Before we get started
2016-04-13 17:27:45 +02:00
Complete the following [guided tutorial ](/lessons/guess-the-number/activity ), and your code should look like this:
2016-03-26 00:47:20 +01:00
```blocks
input.onButtonPressed(Button.A, () => {
2018-04-21 19:52:09 +02:00
let x = Math.randomInt(9)
2016-03-26 00:47:20 +01:00
basic.showNumber(x)
})
```
2017-09-07 22:42:08 +02:00
## Challenge 1
2016-03-26 00:47:20 +01:00
When button `B` is pressed, we want to clear the screen. This will make it so users can play your game over and over again! Add an event handler to handle this case.
```blocks
input.onButtonPressed(Button.A, () => {
2018-04-21 19:52:09 +02:00
let x = Math.randomInt(9)
2016-03-26 00:47:20 +01:00
basic.showNumber(x)
})
input.onButtonPressed(Button.B, () => {
basic.clearScreen()
})
```
2017-09-07 22:42:08 +02:00
## Challenge 2
2016-03-26 00:47:20 +01:00
Show an animation when you clear the screen! Choose what animation makes most sense to you. Be creative!