Skip to contents

Constructor for the goal-class

Usage

# S4 method for class 'goal'
initialize(
  .Object,
  id = character(0),
  position = numeric(2),
  path = NULL,
  busy = FALSE,
  done = FALSE,
  counter = 5
)

Arguments

.Object

For this class, should be left unspecified (see Example).

id

Character that serves as an identifier for the goal. Defaults to an empty character, triggering the random generation of an id.

position

Numerical vector denoting the position of the goal. Defaults to c(0, 0).

path

Numerical matrix of size n x 2 denoting the different intermediate path points between an agent and a goal. In effect defines which path the agent will take to move towards the goal. Defaults to an empty matrix of size 2 x 2.

busy

Logical denoting whether the goal is currently being interacted with. Defaults to FALSE.

done

Logical denoting whether a goal has been completed. Defaults to FALSE.

counter

Numeric denoting the number of time steps the agent should interact with the goal before the goal has been completed. Defaults to 5.

Value

Object of the goal-class

Examples

# Initialize agent
my_goal <- goal(id = "my goal", position = c(1, 1))

# Access the two slots that were specified
my_goal@id
#> [1] "my goal"
my_goal@position
#> An object of class "coordinate"
#> [1] 1 1