runGloss :: SugarScapeScenario
         -> SimulationState StdGen
         -> SimTickOut
         -> Int
         -> AgentColoring
         -> SiteColoring
         -> IO ()
runGloss params initSimState initOut stepsPerSec av cv = do
  let winSize  = (800, 800)
      winTitle = "SugarScape " ++ sgScenarioName params
      
  -- intiialize IORef which holds last simulation state
  ssRef <- newIORef initSimState

  if stepsPerSec > 0
    then
      -- run stimulation, driven by Gloss
      simulateIO 
        (displayGlossWindow winTitle winSize) -- window title and size
        white                     -- background
        stepsPerSec               -- how many steps of the simulation to calculate per second (roughly, depends on rendering performance)
        initOut                   -- initial model = output of each simulation step to be rendered
        (modelToPicture winSize av cv)  -- model-to-picture function
        (renderStep ssRef)    -- 
    else
      animateIO
        (displayGlossWindow winTitle winSize)
        white
        (renderStepAnimate winSize ssRef av cv)
        (const $ return ())
runGloss :: SugarScapeScenario
         -> SimulationState StdGen
         -> SimTickOut
         -> Int
         -> AgentColoring
         -> SiteColoring
         -> IO ()
runGloss params initSimState initOut stepsPerSec av cv = do
  let winSize  = (800, 800)
      winTitle = "SugarScape " ++ sgScenarioName params
      
  -- intiialize IORef which holds last simulation state
  ssRef <- newIORef initSimState

  if stepsPerSec > 0
    then
      -- run stimulation, driven by Gloss
      simulateIO 
        (displayGlossWindow winTitle winSize) -- window title and size
        white                     -- background
        stepsPerSec               -- how many steps of the simulation to calculate per second (roughly, depends on rendering performance)
        initOut                   -- initial model = output of each simulation step to be rendered
        (modelToPicture winSize av cv)  -- model-to-picture function
        (renderStep ssRef)    -- 
    else
      animateIO
        (displayGlossWindow winTitle winSize)
        white
        (renderStepAnimate winSize ssRef av cv)
        (const $ return ())
runGloss params initSimState initOut stepsPerSec av cv = do
  let winSize  = (800, 800)
      winTitle = "SugarScape " ++ sgScenarioName params
      
  -- intiialize IORef which holds last simulation state
  ssRef <- newIORef initSimState

  if stepsPerSec > 0
    then
      -- run stimulation, driven by Gloss
      simulateIO 
        (displayGlossWindow winTitle winSize) -- window title and size
        white                     -- background
        stepsPerSec               -- how many steps of the simulation to calculate per second (roughly, depends on rendering performance)
        initOut                   -- initial model = output of each simulation step to be rendered
        (modelToPicture winSize av cv)  -- model-to-picture function
        (renderStep ssRef)    -- 
    else
      animateIO
        (displayGlossWindow winTitle winSize)
        white
        (renderStepAnimate winSize ssRef av cv)
        (const $ return ())