Langton's ant: Difference between revisions

Content added Content deleted
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 }</lang>
 
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)
>>> headgetCells >>>. getCellshead
where distance (x,y) = max (abs x) (abs y)</lang>