Skip to content

Instantly share code, notes, and snippets.

@lnicola
Created June 26, 2014 12:08
Show Gist options
  • Save lnicola/0f86eb3881a6a9e27844 to your computer and use it in GitHub Desktop.
Save lnicola/0f86eb3881a6a9e27844 to your computer and use it in GitHub Desktop.
module Main where
import Data.List
expand (x, y) = [(0, y), (x, 0), (v1, y), (x, v2), (x - d1, y + d1), (x + d2, y - d2)] where
d1 = min x (v2 - y)
d2 = min y (v1 - x)
v1 = 17
v2 = 13
generate xs len = if newlen == len
then xs
else generate new newlen where
new = nub $ xs ++ concatMap expand xs
newlen = length new
seed x = generate [x] 1
main = print $ seed (0, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment