Session 09


Today's class was a little more informal and dynamic in class. Below are my general notes of what I inteneded to discuss. This may or may not match what we actually did depending on what you guys said/asked.


Panopto Recording



Let's begin by looking at two different POSSIBLE solutions for Activity 1.2 from last week. Let's make sure we talk about the difference again between absolute and a relative motion solution. 




Notice that this first one has a lot of "duplicate" code. This is something that makes itself perfect for a loop.


Let's play with this last one for a little bit. Once you have Square tracer with a loop it gets really easy to make a variety of other shapes:

  1. Look at how different combinations of repeat, turn and length amount can create other shapes:
  2. 4, 90, 100 (square)
  3. 8, 90, 100 (doesn’t make an octagon, makes a square twice)
  4. 8, 45, 100 (tries to make a square, but gets squished when it hits the edges
  5. 8, 45, 50 (octagon)
  6. 3, 120, 150 (triangle)
  7. 6, 60, 75 (hexagon)
  8. 360, 1, 1 (circle)



Task #3, Reading Code (Mystery Method)


Consider the following code. What do you think it will do?

Discuss and demo


If you want, you can play with this and make it your own: