Learning Math and Coding with Robotics

CSP Unit 3 Lesson 5.10b

Linkbot Image Mindstorm Image
Grid Lines:
Tics Lines:
Width px
Hash Lines:
Width px
Font px
Trace Lines:
Robot 1:
Width px
Robot 2:
Width px
Robot 3:
Width px
Robot 4:
Width px
CSP Unit 3 Lesson 5.10b

Although we now have created the code to draw the diamond figure, we would like to make it into a single "drawDiamond" function. Before we do that, however, there is one improvement to make. The recipe we followed was: (1) call the drawSide function to draw the first side, (2) move forward and turn right, (3) call drawSide for the second side, (4) move forward and turn right, and so on. Each call to the drawSide function is followed by commands to move forward and turn right. So it would be better to put those in the drawSide function definition, and then simply have the code call drawSide four times. Make the necessary changes to the pre-placed code to do that.

Load Blocks
Workspace Show Ch Save File Console

Rubbish bin