File tree 13 files changed +274
-0
lines changed
13 files changed +274
-0
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ This code will fill the canvas with light blue circles with a white highlight
3
+ """
4
+ speed (0 )
5
+ ## This function will draw one row of 10 circles
6
+ def draw_circle_row ():
7
+ for i in range (10 ):
8
+ pendown ()
9
+ begin_fill ()
10
+ color ("light blue" )
11
+ circle (20 )
12
+ end_fill ()
13
+ penup ()
14
+ forward (40 )
15
+ ## This function will move Tracy from end of row up to beginning of the row on top
16
+ def move_up_a_row ():
17
+ left (90 )
18
+ forward (40 )
19
+ right (90 )
20
+ backward (400 )
21
+ ## This creates a white highlight in the top right blue circle
22
+ def make_highlight ():
23
+ for i in range (10 ):
24
+ pendown ()
25
+ color ("light blue" )
26
+ circle (10 ,90 )
27
+ color ("white" )
28
+ circle (10 ,90 )
29
+ color ("light blue" )
30
+ circle (10 ,180 )
31
+ penup ()
32
+ forward (40 )
33
+ ## Send Tracy to starting position in bottom left corner
34
+ penup ()
35
+ setposition (- 180 ,- 200 )
36
+ # Call circle drawing function 10 times to fill ten rows
37
+ for i in range (10 ):
38
+ draw_circle_row ()
39
+ move_up_a_row ()
40
+ ## Create the highlights
41
+ penup ()
42
+ setposition (- 180 , - 190 )
43
+ for i in range (10 ):
44
+ make_highlight ()
45
+ move_up_a_row ()
Original file line number Diff line number Diff line change
1
+ penup ()
2
+ setposition (- 200 ,- 200 )
3
+ speed (0 )
4
+ def draw_square ():
5
+ for i in range (4 ):
6
+ pendown ()
7
+ forward (50 )
8
+ left (90 )
9
+ def draw_row ():
10
+ for i in range (8 ):
11
+ draw_square ()
12
+ penup ()
13
+ forward (50 )
14
+ def draw_sidewalk ():
15
+ for i in range (4 ):
16
+ draw_row ()
17
+ left (90 )
18
+ draw_sidewalk ()
Original file line number Diff line number Diff line change
1
+ speed (0 )
2
+ radius = 25
3
+ circle (radius )
4
+ def init ():
5
+ penup ()
6
+ right (90 )
7
+ forward (25 )
8
+ left (90 )
9
+ for i in range (3 ):
10
+ init ()
11
+ pendown ()
12
+ radius = radius + 25
13
+ circle (radius )
Original file line number Diff line number Diff line change
1
+ speed (0 )
2
+ penup ()
3
+ setposition (- 150 ,0 )
4
+ pendown ()
5
+
6
+ def make_square ():
7
+ length = 10
8
+ for i in range (5 ):
9
+ for i in range (4 ):
10
+ pendown ()
11
+ forward (length )
12
+ left (90 )
13
+ penup ()
14
+ forward (length * 2 )
15
+ length = length + 10
16
+ make_square ()
Original file line number Diff line number Diff line change
1
+ for i in range (6 ):
2
+ forward (50 )
3
+ left (60 )
Original file line number Diff line number Diff line change
1
+ left (45 )
2
+ for i in range (4 ):
3
+ left (90 )
4
+ forward (100 )
5
+ backward (100 )
Original file line number Diff line number Diff line change
1
+ speed (0 )
2
+ penup ()
3
+ setposition (- 100 , - 200 )
4
+ for i in range (3 ):
5
+ pendown ()
6
+ circle (50 )
7
+ penup ()
8
+ forward (100 )
9
+ setposition (- 50 , - 100 )
10
+ for i in range (2 ):
11
+ pendown ()
12
+ circle (50 )
13
+ penup ()
14
+ forward (100 )
15
+ setposition (0 , 0 )
16
+ pendown ()
17
+ circle (50 )
18
+ penup ()
19
+ forward (100 )
Original file line number Diff line number Diff line change
1
+ penup ()
2
+ setposition (- 100 , - 200 )
3
+ ## Makes the bottom three circles.
4
+ for i in range (3 ):
5
+ pendown ()
6
+ circle (50 )
7
+ penup ()
8
+ forward (100 )
9
+ setposition (- 50 , - 100 )
10
+ ## Makes the middle two circles.
11
+ for i in range (2 ):
12
+ pendown ()
13
+ circle (50 )
14
+ penup ()
15
+ forward (100 )
16
+ """
17
+ Makes the last circle.
18
+ """
19
+ setposition (0 , 0 )
20
+ pendown ()
21
+ circle (50 )
22
+ penup ()
23
+ forward (100 )
Original file line number Diff line number Diff line change
1
+ speed (0 )
2
+ def make_half_bracelet ():
3
+ for i in range (18 ):
4
+ left (10 )
5
+ penup ()
6
+ forward (100 )
7
+ pendown ()
8
+ circle (10 )
9
+ penup ()
10
+ backward (100 )
11
+ for i in range (2 ):
12
+ make_half_bracelet ()
Original file line number Diff line number Diff line change
1
+ speed (0 )
2
+ penup ()
3
+ setposition (- 25 , - 200 )
4
+ def square_circle_stack ():
5
+ pendown ()
6
+ for i in range (4 ):
7
+ forward (50 )
8
+ left (90 )
9
+ penup ()
10
+ left (90 )
11
+ forward (50 )
12
+ right (90 )
13
+ forward (25 )
14
+ pendown ()
15
+ circle (25 )
16
+ penup ()
17
+ backward (25 )
18
+ left (90 )
19
+ forward (50 )
20
+ right (90 )
21
+ for i in range (4 ):
22
+ square_circle_stack ()
Original file line number Diff line number Diff line change
1
+ speed (0 )
2
+ pensize (5 )
3
+ color ("red" )
4
+ penup ()
5
+ backward (100 )
6
+ pendown ()
7
+ forward (200 )
8
+ penup ()
9
+ left (120 )
10
+ for i in range (4 ):
11
+ pendown ()
12
+ color ("blue" )
13
+ forward (50 )
14
+ left (120 )
15
+ color ("green" )
16
+ forward (50 )
17
+ right (120 )
Original file line number Diff line number Diff line change
1
+ speed (0 )
2
+ def make_three_circles ():
3
+ for i in range (12 ):
4
+ left (10 )
5
+ penup ()
6
+ forward (100 )
7
+ pendown ()
8
+ color ("red" )
9
+ begin_fill ()
10
+ circle (10 )
11
+ end_fill ()
12
+ penup ()
13
+ backward (100 )
14
+
15
+ left (10 )
16
+ penup ()
17
+ forward (100 )
18
+ pendown ()
19
+ color ("purple" )
20
+ begin_fill ()
21
+ circle (10 )
22
+ end_fill ()
23
+ penup ()
24
+ backward (100 )
25
+
26
+ left (10 )
27
+ penup ()
28
+ forward (100 )
29
+ pendown ()
30
+ color ("blue" )
31
+ begin_fill ()
32
+ circle (10 )
33
+ end_fill ()
34
+ penup ()
35
+ backward (100 )
36
+ make_three_circles ()
Original file line number Diff line number Diff line change
1
+ """
2
+ This code will create 4 different shapes with different colors
3
+ """
4
+ penup ()
5
+ speed (0 )
6
+ ## Creates a green pentagon
7
+ def green_shape ():
8
+ color ("green" )
9
+ begin_fill ()
10
+ circle (60 ,360 ,5 )
11
+ end_fill ()
12
+ ## Creates a blue circle
13
+ def blue_shape ():
14
+ color ("blue" )
15
+ begin_fill ()
16
+ circle (60 )
17
+ end_fill ()
18
+ ## Creates a red diamond
19
+ def red_shape ():
20
+ color ("red" )
21
+ begin_fill ()
22
+ circle (60 ,360 ,4 )
23
+ end_fill ()
24
+ ## Creates a yellow half circle
25
+ def yellow_shape ():
26
+ color ("yellow" )
27
+ begin_fill ()
28
+ circle (60 ,180 )
29
+ end_fill ()
30
+ setposition (100 , - 150 )
31
+ pendown ()
32
+ green_shape ()
33
+ penup ()
34
+ setposition (100 , 50 )
35
+ pendown ()
36
+ blue_shape ()
37
+ penup ()
38
+ setposition (- 100 , 50 )
39
+ pendown ()
40
+ red_shape ()
41
+ penup ()
42
+ setposition (- 100 , - 150 )
43
+ pendown ()
44
+ yellow_shape ()
45
+ penup ()
You can’t perform that action at this time.
0 commit comments