Lesson 1 of 0
In Progress
Session 11: Number Quiz with Quarky
We are going to create a game with Buttons and LED.
The logic for this game is simple:
- Tobi will show us two numbers L and R, selected randomly between 1 to 100.
- The user needs to input if the number L or R is greater by clicking on the button L if L is bigger, or R if R is bigger.
- Quarky will then check if the input entered is correct or not. If it’s correct, Green LEDs will glow, and if it’s wrong, Red will glow.
That’s it! Now, let’s get started.
Let’s Code!

Alert: Make sure that your Quarky is connected to PictoBlox either using Bluetooth or USB.
Follow the steps below to make the script:
- Go to the Events palette and add when flag clicked block into the scripting area.
- Go to the Events palette and add broadcast () and wait block below the when flag clicked block. This will broadcast a message that activates when I receive () block from the Event palette. Write the message as Reset.
- Add when I receive () block from the Event palette into the scripting Area.
- Create 2 variables – L and R.
- Set L to a random number between 1 to 100 using pick random () to () block.
- Set R to a random number between 1 to 100 using pick random () to () block.
- Add a say () block and write the message “Which number is Bigger? L or R”.
Click on the green flag and check the script till now.
- Add when button () pressed block from the Sensor palette. This block will activate when button L is pressed.
- Add an if () else block from the Control palette. Add the condition L > R in the if block.
- Set the display matrix as () block in the first branch to Green and in the second branch to Red.
- Finally, add broadcast () and wait block to reset the L and R values.
- Duplicate the whole script and change the conditions for the R button:
- Change the button to R.
- Change the condition to R > L
The script is complete.
Test the code.
Assignment
Before you move on to the next lesson, a small assignment awaits you!
You must upload the PictoBlox program you created in this activity to the website. Submitting the assignment is a must in order to receive the certificate after completing the course.
Follow the steps below to upload your assignment:

The file type allowed is the SB3 file generated from the PictoBlox program. The maximum file size allowed is 5 MB.
Good luck!