Page 77 - Ai Robogenius
P. 77

STEP - 13   Drag the 0 = 0 block from the Logic category and place it in the first if

                               condition.

                  STEP - 14   Drag the hand block from the Variables category and drop it in place
                               of the first 0, so it reads if hand = 0.


                                               on  shake

                                                set  hand   to   pick random  0  to  2


                                                 if    hand   =     0    then


                                                 else if  false  then


                                                 else






                  STEP - 15   Drag the 0 = 0 block from the Logic category and place it in the else if

                               condition.

                  STEP - 16   Drag the hand block from the Variables category and drop it in place

                               of the first 0, so it reads else if hand = 1.


                                               on  shake

                                                set  hand   to   pick random  0  to  2

                                                if     hand   =     0    then



                                                else if  hand   =     1   then


                                                else






                  STEP - 17   Add a show icon block from the Basic category in the if hand = 0 section
                               and choose the rock icon.


                  STEP - 18   Add show icon block in the else if hand = 1 section and choose the
                               paper icon.







                                                                             Creative Projects with Micro:Bit
                                                                                                                    75
   72   73   74   75   76   77   78   79   80   81   82