a one dimensional cellular automata, using comonads
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

35 líneas
706B

  1. module Main where
  2. import Comonad
  3. import Automata
  4. import BrickStuff
  5. import Options
  6. import Spaces.Space2
  7. import Brick
  8. import Brick.BChan
  9. import Control.Monad
  10. import Control.Applicative
  11. import Control.Monad.IO.Class
  12. import Control.Concurrent
  13. import qualified Graphics.Vty as V
  14. ---------------
  15. -- main loop --
  16. ---------------
  17. main :: IO ()
  18. main = do
  19. options <- parseArgs
  20. let w = (optWidth options)
  21. let h = (optHeight options)
  22. chan <- newBChan 1
  23. forkIO $ forever $ do
  24. writeBChan chan Tick
  25. threadDelay $ (optTime options) * 10000
  26. g <- initGame
  27. let buildVty = V.mkVty V.defaultConfig
  28. initialVty <- buildVty
  29. void $ customMain initialVty buildVty (Just chan) (app h w) (clamp2 w h g)