Skip to content

Commit

Permalink
Set8: explain coordinate system better
Browse files Browse the repository at this point in the history
  • Loading branch information
opqdonut committed Dec 11, 2020
1 parent 823a07e commit b88f788
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions exercises/Set8.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ red = Color 255 0 0
yellow :: Color
yellow = Color 255 240 0

-- A coordinate is two Ints, x and y.
-- A coordinate is two Ints, x and y. In this project, the (0,0)
-- coordinate is in the top left corner of the image. The x coordinate
-- increases to the right, and the y coordinate increases down.

data Coord = Coord Int Int

Expand All @@ -66,9 +68,9 @@ solid color = Picture (\coord -> color)

-- Here's a simple picture:
examplePicture1 = Picture f
where f (Coord x y) | abs (x+y) < 100 = pink
| max x y < 200 = white
| otherwise = black
where f (Coord x y) | abs (x+y) < 100 = pink -- top corner is pink
| max x y < 200 = white -- surrounded by a white square
| otherwise = black -- rest of the picture is black


-- In order to find out what our example picture looks like, here's a
Expand Down

0 comments on commit b88f788

Please sign in to comment.