ContentsIndex
CA.Wrapper
Description
A wrapper for 2D Cellular Automata. Hides details about displaying the grid.
Synopsis
data Control = Control {
controlN :: Integer
controlRun :: Bool
controlWindowSize :: (Int, Int)
controlSquareSize :: Int
controlSquareSkip :: Int
controlGridSize :: (Int, Int)
controlWarp :: Int
}
runCA :: String -> Int -> Int -> world -> (world -> [[Color]]) -> (world -> world) -> IO ()
callbackDisplay :: IORef Control -> IORef RenderState -> IORef ViewState -> IORef world -> (world -> [[Color]]) -> IO ()
callbackIdle :: IORef Control -> IORef world -> (world -> world) -> IO ()
Documentation
data Control
CA Control Settings.
Constructors
Control
controlN :: Integer
controlRun :: Bool
controlWindowSize :: (Int, Int)
controlSquareSize :: Int
controlSquareSkip :: Int
controlGridSize :: (Int, Int)
controlWarp :: Int
runCA
:: StringThe name of the window.
-> IntThe size of the square in the grid (in pixels)
-> IntNumber of iterations per frame.
-> worldThe initial world.
-> (world -> [[Color]])A function to convert the world to a grid of colored cells.
-> (world -> world)A function to step the world one iteration.
-> IO ()
Run a 2D Cellular Automata, displaying each frame in a window.
callbackDisplay :: IORef Control -> IORef RenderState -> IORef ViewState -> IORef world -> (world -> [[Color]]) -> IO ()
The graphics library calls back on this function when it needs to redraw the window.
callbackIdle :: IORef Control -> IORef world -> (world -> world) -> IO ()
The graphics library calls back on this function when it's finished drawing and it's time to do some computation.
Produced by Haddock version 0.7