diff --git a/main.rkt b/main.rkt index c89fe0b..544e66c 100644 --- a/main.rkt +++ b/main.rkt @@ -49,7 +49,8 @@ ; given a point that is the top-left corner of a square on the grid, returns the amount of edges surrounding that square. (define (count-square p g) ; explanation: - ; for every item in the grid (g), test it against every edge of the box + ; for every item in the grid (g), test it against every edge of the box for equality. these form a list, which is then folded into #t or #f if any match. + ; then only those that match are kept and this list is checked for length to determine the matching lines. (length (filter (lambda (item) (foldl (lambda (x y) (or x y)) #f (for/list ([x (list (point 0 0) (point 0 1) (point 1 0) (point 0 0))]