actors :: ClockAgent
actors :: ClockAgent :: async
actors :: ClockAgent :: defaultinit
actors :: ClockAgent :: do_step
actors :: ClockAgent :: finished_step
actors :: ClockAgent :: nb_finished=
Number of agents that finished their stepactors :: ClockAgent :: nb_steps=
Number of steps to do in the simulationactors $ ClockAgent :: SELF
Type of this instance, automatically specialized in every classactors :: ClockAgent :: async
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
actors :: ClockAgent :: defaultinit
core :: Object :: defaultinit
actors :: ClockAgent :: do_step
actors :: ClockAgent :: finished_step
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
actors :: ClockAgent :: nb_finished=
Number of agents that finished their stepactors :: ClockAgent :: nb_steps=
Number of steps to do in the simulationcore :: Object :: output_class_name
Display class name on stdout (debug only).
# Master of the simulation, it initiates the steps and waits for them to terminate
class ClockAgent
actor
# Number of steps to do in the simulation
var nb_steps: Int
# List of Agents in the simulation
var agents: Array[Agent]
# Number of agents that finished their step
var nb_finished = 0
fun do_step do
for a in agents do a.async.do_step
nb_steps -= 1
end
fun finished_step do
nb_finished += 1
if nb_finished == agents.length then
nb_finished = 0
if nb_steps != 0 then async.do_step
end
end
end
lib/actors/examples/agent_simulation/agent_simulation.nit:20,1--45,3