Presentation is loading. Please wait.

Presentation is loading. Please wait.

Branching with Random Numbers

Similar presentations


Presentation on theme: "Branching with Random Numbers"— Presentation transcript:

1 Branching with Random Numbers

2

3

4

5 Branching with Random Numbers
In the previous version of this world, we asked the user for input to determine who would jump. In this exercise, you will have the computer randomly select who will jump.

6 Random numbers in Alice
Alice has a world function that will return a random number in a specified range. The numbers it returns are six-digit numbers The numbers are >= to the lower bound specified and < the upper bound specified.

7

8

9

10

11

12

13

14

15

16

17

18

19

20 Random numbers returned
Alice will return numbers such as: 0 <= X < 3

21 Modify our If/Else If the random number is < 1, Alice jumps
If > 1 but < 2, the White Rabbit jumps If >= 2 but < 3, the Cheshire Cat jumps

22 What goes here?

23

24

25

26 ?

27

28 Alternate strategy

29

30

31


Download ppt "Branching with Random Numbers"

Similar presentations


Ads by Google