Anonymous user
Langton's ant: Difference between revisions
m
→{{header|Haskell}}: Fixed types
m (→{{header|Haskell}}: some typos) |
m (→{{header|Haskell}}: Fixed types) |
||
Line 2,929:
<lang Haskell>data State = State { antPosition :: Point
, antDirection :: Point
, getCells :: Set Point }
type Point = (Float, Float)</lang>
Now we are ready to express the main part of the algorithm
Line 2,949 ⟶ 2,951:
task = iterate step
>>> dropWhile ((< 50) . distance . antPosition)
>>>
where distance (x,y) = max (abs x) (abs y)</lang>
|