-
Notifications
You must be signed in to change notification settings - Fork 0
/
contest3.scm
62 lines (46 loc) · 1.08 KB
/
contest3.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
;;; Scheme Recursive Art Contest Entry
;;;
;;; Please do not include your name or personal info in this file.
;;;
;;; Title: <CS61A X FIBB>
;;;
;;; Description:
;;; <Albert: You think you are done with fibbinacci?
;;; Use these three lines to describe
;;; its inner meaning.>
(define (draw)
(speed 10)
(define (square-fib n bg)
(color '"#000000")
(begin_fill)
(fd n)
(left 90)
(fd n)
(left 90)
(fd n)
(left 90)
(fd n)
(left 90)
(color bg)
(end_fill)
(color '"#000000")
(quartercircle n) )
(define phi (/ (+ 1 (sqrt 5)) 2))
(define init 30)
(define lst (list "#FF0000" "#FF8000" "#FFFF00" "#00FF00" "#00FFFF" "#0000FF" "#8000FF" "#FF00FF" )) ;TK: Could make an infifnite list.
(define (inf-squ-fib n colour_list)
(define (helper curr colour)
(if (> curr n)
nil
((square-fib (* (expt phi curr) init) (car colour))
(helper (+ curr 1) (cdr colour))
)
)
)
(helper 0 colour_list)
)
(inf-squ-fib 7 lst)
(exitonclick))
; Please leave this last line alone. You may add additional procedures above
; this line.
(draw)