Sunday, October 2, 2022

Abstraction, Algorithms, & Lego Sculptures

Students worked together on an unplugged activity in which a "robot" would select from a variety of legos to build a structure on a thick-green 8x16 lego baseplate. Each team member picked at least 1 brick, placed it, wrote a line of code to move it, and also tested and debugged it. Teams rotated through this process until every student had an opportunity to complete each task at least one time. If time allowed they were encouraged to add more bricks to their sculpture. Using binary code we broke down the lego brick description as follows.

We started with a review of binary code to to identify how many bits were needed to identify the assortment of colors we were using, as well as the height, width, and length. Bits were carefully placed in a pre-determined order so the robot could communicate their intentions with the group, see the images below. Our sets of lego bricks include 7 colors so we needed 3 bits to represent each color. In the end we needed 12 bits or 3 nibbles to represent the bricks in our kit. 


Next students used more abstraction to create a symbolic language to help the "robot" grab a brick, move it, and place it before retracting its arm and repeating the process. One student suggested calling the language they created Legottoson. It was interesting to see some overlap of the symbols as well as some differences. We stressed the importance of using abstractions that make sense. We could have used anything really, like pumpkins or squirrels, instead of arrows. 

Finally, students swapped and executed each others code to see if they could replicate each others sculptures. They identified any known errors along the way and after the "Big Reveal," see below. When pictures of the original sculptures were shown on the projector screen they attempted to identify, debug, and fix any mistakes. We continued to discuss the importance of a common language, that mistakes are OKAY and normal, and that finding the mistakes to fix them was part of the fun of coding.


An example of the original code with debugging and some students at work.
 









No comments:

Post a Comment