Skip to content

Commit 5d73096

Browse files
docs: Intro to Turtles Demo ( Fixes #197 )
1 parent 92baf05 commit 5d73096

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Turtle 101 - Intro to Turtles
2+
3+
# Turtle is a groovy graphics system that dates back to 1966.
4+
5+
# Imagine you are a turtle holding a pen.
6+
7+
# You can:
8+
# * Turn
9+
# * Move Forward
10+
# * Pick up the pen
11+
12+
# Using these fundamental basics, we can theoretically draw any shape.
13+
14+
# Let's start simple, by drawing a line
15+
turtle forward 42 save ./line.svg
16+
17+
# Let's draw a line and take a few turns
18+
turtle forward 42 rotate 120 forward 42 rotate 120 forward 42 rotate 120 stroke '#4488ff' save ./triangle.svg
19+
20+
# Let's make a square
21+
turtle forward 42 rotate 90 forward 42 rotate 90 forward 42 rotate 90 forward 42 rotate 90 stroke '#4488ff' save ./square.svg
22+
23+
# Now let's do it the easier way, with square
24+
turtle square 42 stroke '#4488ff' save ./square2.svg
25+
26+
# Now let's do it the general way, with polygon
27+
turtle polygon 42 4 stroke '#4488ff' save ./square4.svg
28+
29+
# Our turtle is pretty smart, and so it can draw a lot of shapes for us.
30+
31+
# A classic example is a 'flower', which repeats many polygons
32+
turtle flower stroke '#4488ff' save ./flower.svg
33+
34+
35+
36+
37+

0 commit comments

Comments
 (0)