fanf: (Default)
[personal profile] fanf

The past light cones of the cells on the unbounded edges of the pattern have a nasty effect. As you go further into the future, even though you only display a small quadrant near the origin, more and more empty space in the past must be examined to work out the state of the cells in the present. This space leak causes the calculation of each generation to get more expensive as the square of the generation number, even though it would ideally be constant.

To fix this, the size of the original universe must be restricted, instead of restricting its size just for display. Divide the display function into two:

  restrict (x,y) = map (take x) . take y
  display = unlines . map (concatMap show)

We also need to change the grow function to deal with the other two edges of the universe.

  bracket a xs = [a] ++ xs ++ [a]
  grow = (bracket deadline) . map (bracket deadcell)

Then in the loop we remove the dimension argument to display and change the main program to:

  main = loop $ restrict (10,10) glider

This is enough to make it possible to compute the 1103 interesting generations of the R pentomino at a few generations per second (text output being rather slow).

March 2026

S M T W T F S
1234567
8910111213 14
15161718192021
22232425262728
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 2026-04-19 05:44
Powered by Dreamwidth Studios