Skip to content

Instantly share code, notes, and snippets.

@kraklin kraklin/longIf.elm
Created Jun 25, 2016

Embed
What would you like to do?
getCoordsForPosition position =
-- first quadrant
if List.member position [1..5] then
{ x = (9 * position - 4.5), y = 41 }
else if List.member position [6..9] then
{ x = 40.5, y = 41 - (position - 5) * 9 }
else if position == 10 then
{ x = 49.5, y = 5 }
-- second quadrant
else if List.member position [11..15] then
{ x = 58.5, y = 0.5 + (9 * (position - 10) - 4.5) }
else if List.member position [16..19] then
{ x = 67.5 + (9 * (position - 16)), y = 41 }
else if position == 20 then
{ x = 94.5, y = 50 }
-- third quadrant
else if List.member position [21..25] then
{ x = 94.5 - (9 * (position - 21)), y = 59 }
else if List.member position [26..29] then
{ x = 58.5, y = 59 + (9 * (position - 25)) }
else if position == 30 then
{ x = 49.5, y = 95 }
-- forth quadrant
else if List.member position [31..35] then
{ x = 40.5, y = 95 - (9 * (position - 31)) }
else if List.member position [36..39] then
{ x = 31.5 - (9 * (position - 36)), y = 59 }
else if position == 40 then
{ x = 4.5, y = 50 }
else
{ x = 200, y = 200 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.