CSC151 2010S, Class 41: Analyzing Procedures
Overview:
* HW 7
* Project Proposals
* Analyzing Procedures
* Comparing algorithms.
* Two related metrics:
Time and Procedure Calls.
* Counting procedure calls by printing.
* Tools for analysis.
* Lab!
Admin:
* We seem to have a number of ill students
today. Please take extra precautions this
week. (Wash hands regularly, get enough
sleep, etc.)
* Preregistration is upon us! Please talk to
me about what CS course you should take next.
HW 7
; A bit of preparation for testing
(define world (image-show (image-new 200 200)))
(define yertle (turtle-new world))
(turtle-teleport! yertle 50 50)
(define koch-side!
(lambda (turtle n side-length)
(cond
((= n 0)
(turtle-forward! turtle side-length))
(else
(koch-side! turtle (- n 1) (* side-length 2/3))
(turtle-turn! turtle -60)
(koch-side! turtle (- n 1) (/ side-length 3))
(turtle-turn! turtle 120)
(koch-side! turtle (- n 1) (/ side-length 3))
(turtle-turn! turtle -60)))))
(define koch-snowflake!
(lambda (turtle n side-length)
(repeat 3
(lambda ()
(koch-side! turtle n side-length)
(turtle-turn! turtle 120)))
))