Drawing 3d nets - Platonic solids This is a basic version of the rather more difficult Drawing 3d nets - Archimedean solids .

I have a weakness for 3d nets which when cut out and folded allow you to make 3d shapes out of paper or card.  The task is simple, write the shortest program you can that draws nets for the 5 Platonic solids. The output should be an image file in any sensible format of your choosing (png, jpg, etc.).  

All five shapes are described at http://en.wikipedia.org/wiki/Platonic_solid . Their nets looks like this (taken from http://www.newscientist.com/gallery/unfolding-the-earth/2 ).



Input: An integer from 1 to 5.  Assume the shapes are numbered in order of the number of sides they have. So, 1 would be a tetrahedron and 5 the icosahedron.

Output: An image file containing the net for that shape. Just the outline including the internal lines is OK. There is no need to fill it in with colors

You can use any programming language you like as well as any library that was not made especially for this competition. Both should be available freely however (in both senses) online.

I will accept the answer with the smallest number of characters in exactly one week's time.

Winner. Only one entrant but it was wonderful. The winner is ... Raufio for what is my favourite piece of code golf ever.
Python, 456 429 381
import turtle as t
L=&quot;fl&quot;
R=&quot;fr&quot;
d=L*3+R*3
b=(d+R)*3
a=[b,120,L*3+&quot;fflflffflflfrflflfffl&quot;+R*4+&quot;flf&quot;,90,b+&quot;ffrfrflffrffrfrfrflflf&quot;,120,(R*5+L*5+R+L)*5+&quot;rrfr&quot;+L*5+R*2+L*2+R*4+&quot;f&quot;,72,(d+&quot;f&quot;)*5+&quot;rfl&quot;+((d+&quot;b&quot;)*5)[:-1],120]
l=t.lt
f=t.fd
b=t.bk
r=t.rt
p=input()*2-2 
t.setup(.9,.9)
t.goto(-200,150)
t.clear()
for c in a[p]:exec c+&quot;(a[p+1])&quot;
t.getscreen().getcanvas().postscript(file=&quot;o&quot;)

I implemented a primitive interpreter with l r f b as operators that move the turtle cursor around at the angle of the shapes. At one time, it turns only one angle. I compressed the strings by reusing strings (kind of like psuedo-subroutines), other than that, I didn't check to see if I was using the best path. It outputs to a postscript file.
A little explanation of un-golfed code:
import turtle as t
Left=&quot;fl&quot;
Right=&quot;fr&quot;
diamond= Left*3 + Right*3
tetrahedron=(d+R)*3 #used to be b

Imports the built-in turtle module and defines the macros that shorten the strings. The turtle module uses commands to move a 'turtle' around the screen (ie forward(100), left(90))
netList=[
   #tetrahedron
   tetrahedron,120,
   #cube
   Left*3+&quot;fflflffflflfrflflfffl&quot;+Right*4+&quot;flf&quot;,90,
   #octohedron, builds off the tetrahedron
   tetrahedron+&quot;ffrfrflffrffrfrfrflflf&quot;,120,
   #dodecahedron
   (Right*5 + Left*5 + Right + Left)*5
    +&quot;rrfr&quot;+
    Left*5 + Right*2 + Left*2 + Right*4 + &quot;f&quot;,72,
   #icosahedron
   (diamond+&quot;f&quot;)*5 +&quot;rfl&quot;+((diamond+&quot;b&quot;)*5)[:-1],120
]

This list holds the angles and movement sequences. The tetrahedron was saved to reuse with the octohedren.
l=t.left
f=t.forward
b=t.back
r=t.right

This is the part that i like, it makes single character local functions so the calls can be shortened and automated through pre-defined strings.
input=int(raw_input())*2-2 
t.setup(.9,.9)
t.goto(-200,150)
t.clear()

This starts by taking the input (between 1 and 5), and converting that to an index that points to the shape string in the netList. These setup turtle to show the whole net. These could be left out if the task was just to draw them, but since we need a picture output they are needed.
for command in netList[input]:
    exec command+&quot;(netList[input+1])&quot;
t.getscreen().getcanvas().postscript(file=&quot;o&quot;)

The for loop takes the commands in the command sequence string and executes them, so for a string like &quot;fl&quot;, this executes &quot;forward(angle);left(angle);&quot; by calling the newly created local functions. the last line outputs a file called 'o' that is in postscript format format using turtle function.
To run:
Copy it into a file and run it from there. When you run it, it will wait for a number input between 1 and 5 (i just changed it so that it asks before setting up turtle). When you input a number, a window pops up and draws the net. if you want it to go faster you can add t.speed(200) before setup.
You can copy-paste it into the interpreter, but when raw_input() is called it consumes the next string you input &quot;t.setup(.9,.9)&quot; instead of a number. So if you do this, copy up until raw_input(), input a number, than copy paste the rest. It is intended to be run as a whole. Or you could copy it into a function and call it.
Here are it's outputs (converted from postscript):
Note: the position of these in the window has changed, but their overall shape is the same.





It's a little brute force for code golf, but I got tired of trying to find a consistent pattern between the shapes.