a1tD0000007krezIAA

Course: Introduction to Programming with NAO
5. Random

  • 6-9 grade
  • Beginner

Lesson Description:

Lesson Description:
In this lesson, the students will make the NAO robot pick and say a different number each time by using the Random Int box in Choregraphe.
Introducing a new concept: random numbers.

Objectives

  • Make the difference between random and definite.
  • Define a range and limits of a pool of numbers.
  • Program the robot to say a random number in the story.

image description

Lesson Modules


Teaching Tips:

The code example for this lesson can be downloaded from here.

You can run the program on NAO to start the lesson. The program makes NAO tell numbers a certain number of times. 

By default the first number is a random number between 1 and 10; the second number is always the same. And the NAO will speak 3 series of two numbers.

If you want to modify the range or the numbers you can edit the code. 


Listen to NAO and pay attention to the numbers he speaks.  

In your own words what do you notice about the series of numbers NAO speaks?


A random number is a number that cannot be predicted before it is generated.
A simple way to create a random number is to start counting in your head until your friend stops your counting.
The number that you will generate cannot be predicted by either of you.


A random number can be limited by minimum and maximum values.


Teaching Tips:

In this module, we want to explore more the concept of random.

Why is it useful? One way to think of it is to create some surprise and give some " character " to a program or a robot. 

If the robot was totally predictable it would be more a puppet or an automat than a robot. Introducing some randomness can make up for the predictability. 

In order to introduce the students and let them use the box Random init in their program in order to include randomness in a story, they'll have the NAO tell we need to explain the following concepts: 

  • Range of numbers
  • Lower value 
  • Upper value
  • increment

To discuss this you can open the program you downloaded and click the wrench of the Random Init box to show its parameters. 

An example can be played out in the class with the following scenario : 

Ask students to group in a pair. In turn one student count in his head a number from the range defined by the other students and repeat until he's asked to stop. 

For example range 1 to 20 ( 1 is the lower value; 20 upper value), the student counts from 1 to 20 and go back 1 to 20 until he's told to stop. 

When he stops he reveals the number which is written down. 

Then they switch student 1 is now counting while student 2 defines the limits of the count. This can be repeated two or three times.

Follow the teacher instruction to group in pairs and simulate a random number generation algorithm with your peer. 

Write down the outcome: 

What is the range you chose?



What are the numbers you got when stopping your partner count on round 1?



What are the numbers you got when stopping your partner count on round 2?


Teaching Tips:

The program downloaded in the first module is an easy example of the tasks that the students need to do. 

A better one would be to suggest to the students to create jokes that the robot can tell or a story with 3 outcomes. 

They will need to use the following boxes : 

  • Random int 
  • Counter
  • Switch box
  • Say box

Open your Choregraphe software and create a program that makes the NAO robot tell different things randomly. 

You should create at least 3 possible outcomes of your program and make the robot pick randomly 1 out of the 3 outcomes. 

Repeat your program 2 times to play 2 different outcomes.


Teaching Tips:



AFTER CLASS

Store Student Files
Put the student files on a thumb drive or store them in some way so that the students can continue working on their project in the next lesson. 

Pack Up Hardware
Pack the robots and computers according to the packing instructions.

What is a random number?
How do you think a random number is generated?
What is the difference between a random number and a predicted number?