creatur-5.9.19: Framework for artificial life experiments.

Copyright(c) Amy de Buitléir 2012-2016
LicenseBSD-style
Maintaineramy@nualeargais.ie
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

ALife.Creatur.Clock

Description

An internal simulation clock which persists between runs. This is a simple counter, completely independent from any system clock or hardware clock. The clock does not automatically advance, it only advances when incTime is called. In this way, the Créatúr framework will run consistently, treating all agents fairly, regardless of current processor load. It also ensures that data obtained from simulation runs on different machines with different CPU performance can still be meaningfully compared.

Synopsis

Documentation

class Clock c where Source #

A clock representing the time in a Créatúr universe. It is used to schedule events and ensure that each agent gets its fair share of the CPU. This clock is entirely separate from the system clock. It advances only when incTime is called. This allows Créatúr to run without being affected by other processes which might be using the CPU at the same time.

Minimal complete definition

currentTime, incTime

Methods

currentTime :: StateT c IO Time Source #

The current time, measured in "ticks"

incTime :: StateT c IO () Source #

Advance the clock to the next "tick".