CSC151 2009F, Class 34: Randomized (Unpredictable) Drawing Admin: * Happy belated halloween! * Are there questions on exam 2? * Reading for Tuesday: Characters and Strings * There was enough difficulty on Friday's quiz that I'm not counting it * I'm also not returning it today * Anyone who did not take it on Friday should take it now * After discussing the quiz, I'll try to do a quick intro today. (I failed) Overview: * About the quiz. * Random art. * Why use randomness. * The random procedure. * Simulation. Exam questions * Question 4: What type should drawings-largest return? * A drawing * Question 3: Can we make it work with ellipses? * Yes * Will we get extra credit if we do it correctly? * Maybe * Will we lose credit if we do it incorrectly? * Probably * Question 5: Can we define turtle-polygon! separately? * Yes * Can we copy it from the appropriate homework assignment? * Yes, provided you cite that homework. * Question 10: Does it matter that max works with fifteen (or ten or ...) elements as well as two? * No. Quiz (define whatzitdo (lambda (vals) (and (not (null? vals)) (or (and (integer? (car vals)) (odd? (car vals))) (whatzitdo (cdr vals)))))) * If vals is empty, returns #f * If vals is a one-element list, (x) * If x is an odd integer, returns #t * If x is not an odd integer, returns #f * If vals is a multiple-element list (X stuff) * If first element is odd integer, returns #t * Otherwise recurses * So, returns #t if there is an odd element in the list. Simulate the idea that art can be unpredictable, with limited involvement from "the artist" Most languages provide a procedure that gives back "random" (unpredictable) results (random N) = > a number between 0 and N-1 (define count-from (lambda (lower upper) (let kernel ((position lower)) (if ______________ (list upper) (cons (position (kernel _____________)))))))