-
Notifications
You must be signed in to change notification settings - Fork 0
/
contest5.scm
151 lines (95 loc) · 1.75 KB
/
contest5.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
;;; 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)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(left 90)
(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 20)
(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)