Tilman Baum
Tilman Baum

Reputation: 39

identify highest value of several variables of one agent

I have an agent that has 3 variables quantifying the area required for certain tasks as calculated by other agents. The agent has another variable "max_area", and in each tick, this should be given the maximal value.

e.g the agent has the variables area_cattle: 100 area_gather: 200 area_fields: 300

tick

area_cattle: 200 area_gather: 500 area_fields: 200

and i want it to set its variable max_area to 300, then in the next tick to 500.

any ideas?

many thanks!

Upvotes: 1

Views: 31

Answers (1)

Nicolas Payette
Nicolas Payette

Reputation: 14972

You can built a list out of the values in your three variables and use max on that list:

set max_area max (list area_cattle area_gather area_fields)

Upvotes: 2

Related Questions