Functional Problem Solving (CSC 151 2015F) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Taking Notes] [Rubric] [Remote Access]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Labs] [Outlines] [Readings] - [Examples] [Handouts]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Curtsinger (2015F)] [Davis (2013F)] [Rebelsky (2015S)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Issue Tracker (Course)]
Overview
We'll look at the first problem. I'll probably return it tomorrow.
You wrote something like:
(define sample-and-replace-d!
(lambda (image left top width height)
(let ([color1 (random-sample image left top width height)]
[color2 (random-sample image left top width height)]
[color3 (random-sample image left top width height)])
(when (and (< (irgb-distance color1 color2) 50)
(< (irgb-distance color2 color3) 50)
(< (irgb-distance color3 color1) 50))
(fill-rectangle! image left top width height
(irgb-average-3 color1 color2 color3))))))
We can use recursion!
(cond
[(and (< (irgb-distance color1 color2) 50)
(< (irgb-distance color2 color3) 50)
(< (irgb-distance color3 color1) 50))
(fill-rectangle! image left top width height
(irgb-average-3 color1 color2 color3))]
[else
; recurse on the top-left quarter
; recurse on the top-right quarter
; recurse on the bottom-left quarter
; recurson on the bottom-right quarter])
Problem 6: Two approaches
quotient and modulo.map to generalize.Question too complex to rephrase on the eboard.
> (map list (list "sam" "tyler" "bailey") (list "jones" "bailey" "doodle"))
'(("sam" "jones") ("tyler" "bailey") ("bailey" "doodle"))
> (map list (list 1 2 3) (list 4 5 6))
'((1 4) (2 5) (3 6))
How many test cases on problem 1?
I came up with something like 3 x 2 x 3 x 4 approaches. I combined some things into a test of multiple concepts. I ended up with ten or so.
Are drawings that are not renderable (e.g. because they don't have any points that fall within a typical image) still drawings?
Yes.
Should we put an example in problem 1?
Yes. Show the first few lines of it failing massively on the incorrect implementation.
Should we get rid of the ugly X's?
That would be nice. You can keep beautiful X's, though. We do judge an X by it's appearance. (No, that joke failed miserably.)
What does drawing-render! do?
Puts a drawing on top of an existing image.
You should not need it for this exam.
Should we show experiments for everything?
Yes, that's why there's a section for experiments in every problem.
Writeup: 1f, 3h