Introduction to Programming

using the Processing language

Lecturer: Maarten Lamers of the Media Technology MSc program at Leiden University
Teaching assistant: Joris Slob
Course developed by Bas Haring (2004)
Alterations by Maarten Lamers (2005, 2006, 2007)

Course homepage



Fun programming

Some of our students have indicated that they would like to try some more 'advanced' assignments, wish to practice a little mathematics, or just like to solve puzzles... For these students, we created this add-on to the course slides. The material offered on this page is not formally part of the course.

Below you find a small selection of fun programming assignments that you may try to do. They are not particularly difficult, so even novice programmers can try them. We focussed on slightly more advanced problem-solving skills and a little mathematics for you to practice.

Enjoy!
Maarten Lamers and Joris Slob


Draw-a-Sine

Write a program that draws exaclty one full period of the sine-function, in such a way that
  1. one period fills exactly the width of the output canvas,
  2. the peaks touch the top and bottom of the output canvas,
even when you would change the size of the output canvas! Actually, our code only uses things that you learned in Lecture I. (created by Joris Slob)



Colored Spiral

Write a program that creates the following colored spiral. For this, you will need to apply both a sin() and cos() function. Actually, our code only uses things that you learned in Lecture I, plus one call to the colorMode() function. (created by Joris Slob and Maarten Lamers)



Droste-effect

This program is based around a function droste() that recursively draws an image over itself, creating the 'Droste effect' as on the famous Dutch chocolate box. The Droste image on the right is created by drawing the left image 4 times over itself. See if you can understand the program code, or even write it yourself. Or experiment on the cover of Pink Floyd's album 'Ummagumma'. (created by Joris Slob and Maarten Lamers)