programmingMS 2013
Shodor > SUCCEED > Workshops > Archive > programmingMS 2013

To begin the class, Joel reviewed concepts that had been covered the previous day. The students then worked on the code for "Follow The Leader", which initially has a line of ten squares moving in a clockwise loop around a canvas. The students were tasked with changing the shape of the first half of the squares to circles, but leaving the second half as squares. They did this using conditional statements in a for-loop going through an array of the shapes of each item. After successfully changing the shapes, they tried to change the color of the sixth item in the line, but leave the color of the other ones the same. They did this by using a conditional within the for-loop to change the color at only a specific index. The final change the students were challenged with was making the first three shapes circles, the second three triangles, and the rest squares. They were able to do this by using conditionals in an "if", "else if", "else" statement to test the position in the for-loop to make the correct number of each shape.

The students were then taught about loops, starting with for-loops. They were taught about how to make for-loops and what they are used for. Next, the students were taught about "while loops" and "do while" loops. They started working on the Paddle Ball model after learning about loops. This model was a game of paddle ball that initially had five balls that bounced around that the student could block with a paddle they control with their cursor. The code initially didn't work because the loops had been left out so the students had to decide which types of loops to use and how to implement the loops. After they added the correct loops, they tried to make it so that there could be more balls bouncing around. They did this by using a for-loop to add elements to the array of speeds which automatically added more balls. They were also able to make each ball have different speeds by doing this. They then continued experimenting with the applet by adding colors, making the balls different speeds, and changing the size of the paddle.