2016-05-09 19:32:02 +02:00
|
|
|
# guess the number tutorial
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## ~avatar avatar
|
2016-05-09 19:32:02 +02:00
|
|
|
|
|
|
|
This tutorial will help you create a guess the number game! Let's get started!
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## ~
|
2016-05-09 19:32:02 +02:00
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## Rebuild the game!
|
2016-05-09 19:32:02 +02:00
|
|
|
|
|
|
|
The blocks have been shuffled! Put them back together so that...
|
|
|
|
* when the user presses button ``A``,
|
|
|
|
* generate a random number
|
|
|
|
* show the number on screen
|
|
|
|
|
|
|
|
|
|
|
|
```shuffle
|
|
|
|
input.onButtonPressed(Button.A, () => {
|
2018-04-21 19:52:09 +02:00
|
|
|
let x = Math.randomInt(10)
|
2016-05-09 19:32:02 +02:00
|
|
|
basic.showNumber(x)
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|