This page is kept for historical purposes only. Please see the home page for my current situation. —Luca Saiu.
This page is only of historical interest. If you still have to pass DLL, go to the rattrapage page.

DLL Project: collaborative development

You have to collaborate with your course colleagues and, together, write a turtle-graphics system entirely in Scheme. The resulting software must be free software and run on Guile on (at least) GNU/Linux systems.
Make sure you correctly deal with legal issues such as copyright and license notices; you can reuse any piece of free software you like, as long as you respect its license. The finished combined software must be a clean source tarball, with clear authorship, copyright and license information.

Collaboration and communication is essential: you must subscribe to the mailing list, and use it for communicating: I will evaluate you according to what you do, and what you do is always shown on the list, as attached files or patches. I have set up a Bugzilla installation for tracking bugs; everybody is expected to use it. If you only have Internet access at the university lab, that will be enough.

Even if that's not realistic for large free software projects, for simplicity I allow you to write mailing list messages in French rather than in English (if you want). Variable names, comments and documentation must be in English; I'm not asking you to write great literature; let's say that your English should be at least as good as my French.

You have to use bzr for getting the latest sources -- I manage the central repository for you, but you can maintain your branches is you want. I try not to participate too much in development; I can help you, but you have to write the code.

The minimum requirements are easy to satisfy: any fourth-year student should be able to write a simple turtle-graphics system satisfying the minimum requirements, even alone. But together you can make something powerful and exciting.

Do a glorious hack. Surprise me.


Rules


Basic turtle graphics ideas

Here I've drawn in green the image borders, and I've used a green triangle for representing the turtle, "pointing" in the appropriate direction. The point shown within the triangle is the turtle position; the initial position is identified by a green cross; the initial orientation is "up". Here I use red for showing lines traced by the turtle. Of course, these conventions are just for helping you in understanding the ideas: your software only needs to produce what here is shown in red.

Initial state

So, here is the initial state. At the beginning the turtle is at the center of the image, pointing "up":

Rotate and go forward

By executing the code in the picture below from the initial state, we obtain the shown effect. First the turtle rotates left by 45 degrees, then it advances by 70 pixels in the direction it's facing, tracing a line. Notice that 70 pixels is the length of the line, not the length of the line projections on the x or y axis.

Also notice that rotation does not cause the turtle to draw anything.

The pen state

Again starting from the initial state, here we show the effect of the code below.

You can think of the turtle as holding a pen which is by default "down" (touching the paper the turtle is moving on); with the command (pen-up!) we can lift the pen, so that from that point on the turtle can move without drawing. Calling (pen-down!) will lower the pen back to its "down" position, to let the turtle start drawing again when moving.

In the sample code below, first we lift the pen; then we advance by 70 pixels in the current direction (which is up); and now of course this movement does not trace a line. Then we lower the pen again, we turn left by 90 degrees, and we advance again by 70 pixels; since the pen is now "down", this movement traces a line. Notice that the effect would be the same if we moved the (pen-down!) line after the (left 90) line.

The predicate pen-up?, of zero parameters, returns #t if the pen is currently up and #f if it's currently down; hence at the end of the sample code above

(pen-up?)
would return #f.

(pen-up?) has no side effects and does not draw anything.


Minimal requirements

2011-12-01 update: tasks have been in Bugzilla for a while now; you will find many more ideas to develop there, and theirs status will be up-to-date. The list on this page will not be updated.

Implement a Turtle graphics system using Scheme only, running on Guile on (at least) GNU/Linux.

You have to write the code for manipulating data structures representing a picture and a turtle. I'm not asking you to write a Logo interpreter: of course we have Scheme, and we can use it as a language!

For example, a user of your software could write this simple procedure definition for drawing a square using your forward and left procedures.

      (define (square side)
        (forward side)
        (left 90)
        (forward side)
        (left 90)
        (forward side)
        (left 90)
        (forward side)
        (left 90))

      (square 100) ;; draw a square with a 100-pixel side
      (square 30)  ;; draw a smaller square *inside* the bigger one
You can write similar code for testing and to be included as examples, but your main job is to implement the core procedures such as forward and left.

This requires only simple trigonometry and some debugging capacity; it's easy. Any Master-level student must be able to do this, even alone: even if all the other people were pathetic incompetents (and I've already seen they are not) you could do all the work yourself. In practice, you will only have to do part of the work.

Reminder: I'm asking the whole DLL class to only build one turtle graphics system, working in a collaborative way. But if there are strong disagreements, or conflicts, or some ambitious group wants to fork we can also do that, and split the project: but please ask me before. I will participate and I want to be informed of any problem.


Simple example

[turtle graphics screenshot]

About the image: made in 2008 by Luca Saiu. I, the author, hereby disclaim any copyright interest and place the image into the public domain.

This is the Scheme code I used to draw the picture on the left in my implementation. Your code does not necessarily need to be compatible with mine, but you should provide all the functionalities reqired for examples such as this one.

Notice that n-times and for-step are non-standard macros that I wrote myself for the 2008 project.

(define circle
  (lambda (size)
    (n-times 360
             (move size)
             (left 1))))

(let ((angle 15)
      (rounds 5))
  (for-step i 0 (* 360 rounds) angle
            (circle (/ i 1000))
            (left angle)))
                  

Slightly more advanced tasks

2011-12-01 update: tasks have been in Bugzilla for a while now; you will find many more ideas to develop there, and theirs status will be up-to-date. The list on this page will not be updated.

Make the graphic system more powerful. Here are some ideas:


Advanced tasks

2011-12-01 update: tasks have been in Bugzilla for a while now; you will find many more ideas to develop there, and theirs status will be up-to-date. The list on this page will not be updated.

Not everybody needs to do these: we just need one or two strong groups working on the implementation and maintaining (a reasonable degree of) interface compatibility, so that all the others can benefit.


Communication and synchronization infrastructure

You must use the following tools:


Documentation

Possibly the hardest part in this project is to familiarize yourself with the software we use. You have an opportunity of learning something you will use again in the future; or if not, you will at least learn to learn quickly, and to use the documentation -- this is really important.


Hints

Here are some suggestions:


This page is only of historical interest. If you still have to pass DLL, go to the rattrapage page.

Back to my home page...


Luca Saiu
Last modified: 2012-01-27
Copyright © 2011 Luca Saiu
Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.