The first drawing is formed only with elementar motifs: rectangulars, squares and triangle. Here is the associated
code:
to rec :lo :la
# draws a rectangular with choosen dimansion
repeat 2[forward :lo right 90 forward :la right 90]
end
to square :c
# Draws a square with side length :c
repeat 4[forward :c right 90]
end
to tri :c
# Draws an equilateral triangle with side length :c
repeat 3[forward :c right 120]
end
to leg :c
rec 20*:c 30*:c square 20*:c
end
to antenna :c
forward 30*:c left 90 forward 10*:c right 90 square 20*:c
penup back 30 *:c right 90 forward 10*:c left 90 pendown
end
to robot :c
clearscreen hideturtle
# body
rec 40*:c 280* :c
# legs
right 90 forward 20*:c leg :c forward 40* :c leg :c forward 140*:c leg :c forward 40*:c leg :c
# queue
penup left 90 forward 40* :c pendown right 45 forward 110*:c back 110* :c left 135
# head
forward 180 *:c square 10*:c forward 30*:c square 10*:c right 90 forward 10*:c left 90
forward 20*:c right 90 square 80* :c
# ears
forward 40*:c left 60 tri 30*:c penup right 150 forward 80 *:c left 90 pendown tri 30*:c
# antennas
forward 40 *:c left 90 forward 20*:c right 90 antenna :c left 90 forward 40*:c right 90 antenna :c
# eyes
penup back 30 *:c pendown square 10*:c right 90 penup forward 30*:c pendown left 90 square 10*:c
# mouth
penup back 30*:c left 90 forward 30*:c right 90 pendown rec 10*:c 40*:c
end
to frog :c
clearscreen hideturtle
forward 20 *:c right 90 forward 50*:c left 90 forward 40*:c
left 90 forward 70 *:c right 90 forward 70*:c right 90
forward 210 *:c right 90 forward 20*:c left 90 forward 20*:c
right 90 forward 90*:c right 90 forward 20*:c left 90
forward 20*:c right 90 forward 90*:c right 90 forward 20*:c
right 90 forward 70*:c back 50*:c left 90 forward 40*:c
right 90 forward 40*:c back 40*:c left 90 back 20*:c left 90
forward 50*:c left 90 forward 40*:c right 90 forward 70*:c
right 90 penup forward 90*:c pendown repeat 4[forward 20*:c right 90]
end