Learn R Programming

villager (version 2.0.0)

village_state: village_state

Description

This is an object that represents the state of a village at a particular time.

Arguments

Methods

Creates a new State

Public fields

step

The time step that the state is relevant to

agent_states

A list of agent states

resource_states

A list of resource states

Methods


Method new()

Initializes all of the properties in the state to the ones passed in. This should be called by subclasses during initialization.

Usage

village_state$new(
  step = 0,
  agent_states = vector(),
  resource_states = vector()
)

Arguments

step

The time step that the state is relevant to

agent_states

A vector of tibbles representing the states of the agents

resource_states

A vector of tibbles representing the states of the resources

Details

When adding a new property, make sure to add it to the tibble representation.


Method clone()

The objects of this class are cloneable with this method.

Usage

village_state$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

This class acts as a type of record that holds the values of the different village variables. This class can be subclassed to include more variables that aren't present.