Python Drawing Competition
|The first Linux Voice competition is now closed and we’re poring over the entries. Now it’s time for competition number two! This time, we’re looking for programmer’s with artistic flair. The challenge is quite simply to create the best drawing you can using only the Python turtle module (no other modules are allowed) in 100 lines of code or less.
As an example of what you can do, we’ve created the following winter scene using recursion and fractals to keep the number of lines small:
This is created using the script here. The turtle module is really easy to use, and is also an interesting way of visualising coding techniques such as loops and recursion. You can find more details about getting started in our tutorial from issue two. Non-subscribers can get it here:
Linux Voice reader Johno Whitaker has uploaded a python Mandelbrot set generator to github that you can include in your code should you wish: https://github.com/johnowhitaker/turtle-frac
Of course, you don’t have to use fractals. Anything is fine as long as it’s no more than 100 lines of Python (not including comments) and only imports the turtle module. Entries will be judged by the Linux Voice team on artistic merit not code quality, and out decision is final. Entries must be emailed to ben@linuxvoice.com by the end of the 1st May 2014. To be eligible, the entry must be licensed under an OSI approved open source license. Up to three entries per person will be accepted. The winning entry will receive an exclusive Linux Voice winner’s t-shirt.
Update! It turns out that there’s another Python drawing competition going on specifically for students. Check out http://turtleprize.com/ if you’re 16 or under and living in the UK.
*poring over. Call yourselves journalists! 😀
Technical journos don’t need to spell of course, but the typo here clearly is not a mispelling but a missing word…it should have been “pouring scorn over the entries”
Actually I would thought “pouting over the entries”…I bet nobody does a “cringy code” pout like Ben does.
Ben actually was pouring ketchup over the entrées. He has his mind on food all the time, but his choice of condiment is as suspect as his typing skills.
Whoops. Thanks for pointing that out. It’s fixed now.
“poring over” is correct English. Multiple references via Google.
For the lazy I have made a couple of utilities to make our lives easier – https://github.com/johnowhitaker/turtle-frac
(utils.py)
These include:
-Random number generator (6 lines)
-Mandelbrot set method (beautiful fractals in <20 lines)
-a command shortener – you can write multiple commands on one line!! e.g. [["F", 70], ["PD"], ["REP", [["F", 50], ["R", 90]]]]
I will be adding extra bits to it as I need them, hope it helps 🙂
PS sin(x) = (2.718281828459045**(x*1j)).imag, cos(x) = (2.718281828459045**(x*1j)).real if you want those without 'import math'
great inspiration for the turtle prize here! Get your fractals on!
http://turtleprize.com
If you are under 16 living in the UK that is 😛