L-seed-0.2: Plant growing programming game

Lseed.Data

Description

Data definitions for L-seed

Synopsis

Documentation

type UserTag = StringSource

User Tag

type Angle = DoubleSource

Light angle

type Garden a = [Planted a]Source

A list of plants, together with their position in the garden, in the interval [0,1]

type GrowingGarden = Garden GrowthStateSource

Named variants of a garden, for more expressive type signatures

data Planted a Source

A plant with metainformatoin

Constructors

Planted 

Fields

plantPosition :: Double

Position in the garden, interval [0,1]

plantOwner :: Integer

Id of the user that owns this plant

plantOwnerName :: String

Name of the owner of the plant

genome :: GrammarFile

Lsystem in use

phenotype :: Plant a

Actual current form of the plant

type GrowingPlanted = Planted GrowthStateSource

Named variants of a Planted, for more expressive type signatures

data Plant a Source

A plant, which is

Constructors

Plant

a stipe with a length (factor of stipeLength), an angle relative to the parent stipe and a list of plants sprouting at the end

Fields

pData :: a
 
pLength :: Double
 
pAngle :: Angle
 
pUserTag :: UserTag
 
pBranches :: [Plant a]
 

data StipeInfo Source

A straight, untagged plant with length zero and no branches.

Constructors

StipeInfo 

Fields

siLength :: Double

a bit redundant, but what shells

siSubLength :: Double
 
siLight :: Double
 
siSubLight :: Double
 
siAngle :: Angle
 
siDirection :: Angle
 
siOffset :: Double

Sideways position, relative to Plant origin

siHeight :: Double

Vertical distance from bottom

siDistance :: Double

Distance from root

siGrowth :: GrowthState
 

Instances

data GrowthState Source

A GrowingPlant can be growing in one of these three ways:

Constructors

NoGrowth 
EnlargingTo Double

value indicates the growth target

GrowingSeed Double

value indicates the current state [0..1]

Instances

type GrowingPlant = Plant GrowthStateSource

Named variants of a Plant, for more expressive type signatures

data ScreenContent Source

Representation of what is on screen

data Observer Source

Main loop observers

Constructors

Observer 

Fields

obInit :: IO ()

Called once per season, before the main loop starts

obState :: Integer -> Angle -> GrowingGarden -> IO ()

Called once per tick, with the current tick number corresponding light angle and the current state of the garden

obGrowingState :: (ClockTime -> ScreenContent) -> IO ()

Also called once per tick, with a function that calculates the information that should be displayed given a point in time

obFinished :: GrowingGarden -> IO ()

Called before the main loop quits, with the last state of the garden

obShutdown :: IO ()

Called once before program termination

Instances

data GardenSource Source

Methods to get the initial garden and the updated code when a plant multiplies

Constructors

GardenSource 

Fields

getGarden :: IO (Garden ())

Called at the beginning of a season, to aquire the garden

getUpdatedCode :: Planted () -> IO GrammarFile

Given a plant, returns the genome to be used for a seedling.

getScreenMessage :: IO (Maybe String)

Text to display on the screen

type GrammarFile = [GrammarRule]Source

A complete grammar file

data GrammarRule Source

A single Rule. For now, only single branches can be matched, not whole subtree structures

data Cmp Source

Constructors

LE 
Less 
Equals 
Greater 
GE 

Instances