vaccinate

package
v0.0.0-...-b62ce7a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

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.

func (Person) String

func (p Person) String() string

String is a stringer function used to print a person

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 Simulator

type Simulator interface {
	Run()
	Load(dir string) error
}

Simulator is something that loads a configuration and runs a simulation

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL