Week 11 Plan
-
- Nov 4 – turtle basics (video is here)
- Activity 1: make a square with 4 moves and 3 turns.
- Activity 2: make a square with a loop.
- Activity 3: make a random color and width on each side of the square.
- Activity 4: make an octagon or some other polyhedral
- Nov 6- spirals (video is here)
- Activity 1: make a spiral by turn, move, repeat.
- Activity 2: make a spiral by go out, mark, turn around, come back, rotate, repeat.
- Nov 8 – secrets of programming
- turtles with forces or tendencies
- Activity 1: steer a turtle with a sinusioid.
- Activity 2: steer a turtle with Perlin noise.
- Nov 4 – turtle basics (video is here)
Turtle Graphics page with documentation.
Turtle Graphics
See Turtle Graphics under Instructions Menu
Secrets of Programming
Specifications
Every program should have two parts:
-
-
- A specification, usually informal text in comments, that explains how and why your program works.
- The implementation, i.e. the code.
-
Rather than making the code solve your problem directly, you should focus on making the code do exactly what your specification says it does. As you work, you will find both errors in the specification and in the implementation. The problem with writing code directly with English descriptions is that code is too detailed and hard to reason about. Having two perspectives on the problem and its solution is invaluable.
Incremental Development
Start with a simple program that works and modify it incrementally, adding new features one-at-a-time until your program is finished. Test at every step. If you encounter a problem, it will almost always be related to the last change you made, which is both small and fresh in your mind, and therefore quick and easy to fix.
Rubine’s Rule
If you find a bug, fix it. (Due to Dean Rubine, programmer extraordinaire.) Programmers often think they can pursue one problem while ignoring other “unrelated” problems. Those “unrelated” problems are often critical and your misunderstanding of them will cause all sorts of confusion. To avoid getting nailed by your own misundertanding: if you find a bug, fix it.
Write Quality Code
Do not tolerate sloppy code, especially if it is yours. In the words of a former student, you should love yourself and therefore love your code, which is yet another manifestation of who you are. In a way, good code, good art, and good writing are all part of being the person you want to be. Making things of quality may seem more difficult, but if you develop a strong habit of being careful, demanding, critical and exacting, you will find that it actually makes coding easier.