Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsoleSimulator ¶
type ConsoleSimulator struct {
// contains filtered or unexported fields
}
ConsoleSimulator is a kind of Simulator for the console
func (*ConsoleSimulator) Load ¶
func (s *ConsoleSimulator) Load(dir string) error
Load loads the configuration file under dir and populates the list attributes
func (*ConsoleSimulator) Run ¶
func (s *ConsoleSimulator) Run()
Run runs the simulation based on the provided attributes. The first person will be infected by default. This function is useful for running the simulation in console mode when only the results are desired.
type InfectionInfo ¶
type InfectionInfo struct { CommonName string Total int Visits int InfectionRate int InfectedCount int NumberInfections int NumberCured int }
InfectionInfo is a struct for normalizing the simulation result data
type Person ¶
type Person struct {
// contains filtered or unexported fields
}
Person is someone who can get sick.
type PersonList ¶
type PersonList struct {
// contains filtered or unexported fields
}
PersonList is a list of Persons. It is meant to be used as a circular list.
func (*PersonList) InfectionInfo ¶
func (list *PersonList) InfectionInfo() InfectionInfo
InfectionInfo iterates through the list and returns InfectionInfo
type PersonListAttributes ¶
type PersonListAttributes struct { CommonName string InfectionRate int MaxSickDays int NumberOfPeople int Visits int // contains filtered or unexported fields }
PersonListAttributes are attributes of the Personlist
type PersonListStats ¶
type PersonListStats struct {
// contains filtered or unexported fields
}
PersonListStats are statistics about the simulation. It needs to be initialized before use and populated by traversing the list.
type PersonNode ¶
type PersonNode struct {
// contains filtered or unexported fields
}
PersonNode is a node in a circular list
type TerminalSimulator ¶
type TerminalSimulator struct {
// contains filtered or unexported fields
}
TerminalSimulator is a kind of Simulator for a terminal
func (*TerminalSimulator) Load ¶
func (s *TerminalSimulator) Load(dir string) error
Load loads the configuration file under dir and populates the list attributes
func (*TerminalSimulator) Run ¶
func (s *TerminalSimulator) Run()
Run runs the simulation. This implementation will loop forever if Visits is set to 0.