Skip to content

Instantly share code, notes, and snippets.

@prednaz
Created January 25, 2021 23:05
Show Gist options
  • Save prednaz/851ac99464bcf40d36017fe6176fa87c to your computer and use it in GitHub Desktop.
Save prednaz/851ac99464bcf40d36017fe6176fa87c to your computer and use it in GitHub Desktop.
data Tile = Empty Position | Wall Position
data Position = Position Double Double
tiles :: [Tile]
tiles =
[Wall (Position 0 0), Wall (Position 0 1), Wall (Position 0 2)]
tilesFiltered r = [tile | tile <- tiles, norm tile < r]
norm :: Tile -> Double
norm tile =
(x ** 2 + y ** 2) ** (1/2)
where
Position x y =
case tile of
Empty p -> p
Wall p -> p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment