(Code. Canvas. Command-line.) |
The Code 7 Project - Problem 3 - Turtle Drawing
Drawing with code. This was more of a fun exercise than it was "serious" problem-solving. Basically, for problem 3, I tested out the drawing capabilities of the Turtle extension of Python. I made it draw a certain species of fractal pattern (something like the patterns in tree branching or lung branching). The Python code gives simple interactivity with Terminal to let you choose the number of fractal "levels" in the output drawing. My solution just took a couple of functions to modularize things, as well as a little recursion (see example code for "tail recursion" under Problem 2).
Links to more info:
- Info on the "Code 7 Project": hchiam.blogspot.ca/2016/06/code-7-project-github-blog.html
- Problem 3 description: blog.smartbear.com/programming/7-silly-programming-challenges-to-do-for-fun
- GitHub repo of my code for problem 3: github.com/hchiam/code7/blob/master/problem3.py
- Turtle info, basics: opentechschool.github.io/python-beginners/en/simple_drawing.html
- Turtle info, functions: docs.python.org/3/library/turtle.html
- Simple English Wikipedia page on fractals (for a less verbose explanation): simple.wikipedia.org/wiki/Fractal
[EDIT, July 4th, 2016: You can copy and paste this code into the interface at https://trinket.io/python
[EDIT EDIT, July 5th, 2016: Oooor you can run the code right here:]
_________________________
LINKS TO OTHER STUFF:
Favourites
Programming
Original Art
Games
Chinese Learning Projects:
- Book
- HSK 1
- HSK 5
- Homonyms Mnemonics