Coding
Setting up the Code Area
-
Select and drag the
on start
block to the left of the screen and drop it on the bin. -
Select and drag the
forever
block to the left of the screen and drop it on the bin. -
Select Input. Select and drag the
on shake
block to the code area and drop it.
Your code area should look like this:
Creating a Variable
Think of a variable as a box that stores information that can be used throughout our program. We give variables a descriptive name so we and others can understand what is going on within our program.
-
Select Variables. Select make a variable...
-
Type choice and select OK or press enter on your keyboard.
Set Choice To
-
Select Variables. Select and drag a
set choice to 0
block to the code area and attach it within theon shake
block. -
Select Math. Select and drag a
pick random 0 to 10
block to the code area and attach it within the 0 of theset choice to
block. -
Select 10 and type 2.
Your code should look like this:
If Condition
-
Select Logic. Select and drag an
if true then else
block to the code area and attach it underset choice to pick random from 0 to 2
block. -
Select Logic. Select and drag a
0 = 0
block to the code area and attach it within the true of theif then
block. -
Select Variables. Select and drag a
choice
block to the code area and attach it within the first 0 of theif 0 = 0 then
block. -
Select Basic. Select and drag a
show leds
block to the code area and attach it within theif choice = 0
then block. -
Make the following pattern by selecting the squares to represent paper.
Your code shoud look like this:
Else Condition
-
Select Basic. Select and drag a
show leds
block to the code area and attach it within theelse
block. -
Make the following pattern by selecting the squares to represent rock.
Your code should look like this:
If Else Condition
-
Select the + sign below else.
-
Select Logic. Select and drag a
0 = 0
block to the code area and attach it within the blank ofelse if then
block. -
Select Variables. Select and drag a
choice
block to the code area and attach it within the first 0 of theelse if
block. -
Select 0 and type 1.
-
Select Basic. Select and drag a
show leds
block to the code area and attach it within theelse if choice = 1 then
block. -
Create the following pattern to represent scissors.
Your code should look like this: