Logo+Assigment

1. Create a procedure that will create any type of polygon code TO POLYGON :SIDES REPEAT :SIDES [ FORWARD 100 RIGHT 360 / :SIDES ] END

code code POLYGON 3

code || || code POLYGON 4

code || || code POLYGON 5

code || || code POLYGON 6

code || || More programs to try:

code TO RIGHTTRIANGLE :LENGTH FORWARD :LENGTH RIGHT  135 FORWARD :LENGTH * SQRT 2 RIGHT  135 FORWARD :LENGTH RIGHT  90 END

TO PYRAMID RIGHT 45 REPEAT 4 [ REPEAT 10 [ RIGHTTRIANGLE REPCOUNT * 10 ] RIGHT 90 ] LEFT 45 END

PYRAMID

code || || code TO POLYGON :SIDES :LENGTH REPEAT :SIDES [ FORWARD :LENGTH RIGHT 360 / :SIDES ] END

TO HEXAGONFLOWER :PETALS REPEAT :PETALS [ POLYGON 5 50 RIGHT 360 / :PETALS ] END

HEXAGONFLOWER 10

code || || code TO DOWNSLANT :LENGTH REPEAT 2 [ FORWARD :LENGTH RIGHT  135 FORWARD 20 RIGHT  45 ] RIGHT   135 FORWARD 20 LEFT   135 END

TO UPSLANT :LENGTH REPEAT 2 [ FORWARD :LENGTH RIGHT  45 FORWARD 20 RIGHT  135 ] RIGHT   45 FORWARD 20 LEFT   45 END

TO SHEET REPEAT 2 [ DOWNSLANT 100 ] REPEAT 2 [ UPSLANT  100 ] DOWNSLANT 100 REPEAT 2 [ UPSLANT  50  ] DOWNSLANT 50 REPEAT 2 [ DOWNSLANT 10 ] UPSLANT 10 END

SHEET

code || || code TO RECTANGLE :HEIGHT :WIDTH REPEAT 2 [ FORWARD :HEIGHT RIGHT  90 FORWARD :WIDTH RIGHT  90 ] END

TO TRIANGLE :LENGTH RIGHT 45 FORWARD :LENGTH * (SQRT 2) / 2 RIGHT 90 FORWARD :LENGTH * (SQRT 2) / 2 RIGHT 135 FORWARD :LENGTH RIGHT 90 END

TO HOUSE ; draw the house RECTANGLE 100 100

; draw the roof FORWARD 100 TRIANGLE 100 BACK    100

; draw the door RIGHT    90 FORWARD  60 LEFT     180 RECTANGLE 20 40 FORWARD  60 RIGHT    90 END

HOUSE

code || || code TO STAR :LENGTH :POINTS REPEAT :POINTS [ FORWARD :LENGTH RIGHT  180 - (180 / :POINTS) ] END

STAR 200 9

code || || code TO TRIANGLE :LENGTH REPEAT 3 [FORWARD :LENGTH RIGHT 120 ] END

TO TRIANGLEFLOWER :LENGTH :COUNT REPEAT :COUNT [ TRIANGLE :LENGTH RIGHT    360 / :COUNT ] END

TO WEB REPEAT 6 [ TRIANGLEFLOWER REPCOUNT * 25 18 ] END

WEB

code || ||