Sha256: c3e37acf9e5e32dc1ebf9c2eb644fa3aae77b673bf7725a4cb021af10a35d180

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 KB

Contents

# encoding: utf-8

require_relative 'agent/selection'
require_relative 'agent/hash_key_pointer'
require_relative 'agent/petri_net_aspect'
require_relative 'agent/simulation_aspect'

# A dumb agent that represents and helps the user.
#
# An instance of this class (an agent) helps the user to interact
# with the world (YPetri::World instance) and the objects in it
# (Petri net places, transitions, nets etc.). In particular, this
# (YPetri::Agent) class is a convenient place to store various
# "shortcuts" meant to reduce the amount of typing the user has to
# do in order to construct and manipulate the world and its objects
# (such as "pl" instead of "place", "tr" instead of "transition" etc.)
# It would not be a good practice to encumber the classes where these
# methods are implemented with these semi-idiosyncratic shortcuts. This
# way, the implementation of the methods stays the concern of the mother
# classes, and Agent class is responsible for improving the ergonomy
# of their invocation.
# 
class YPetri::Agent
  ★ PetriNetAspect                  # ★ means include
  ★ SimulationAspect

  attr_reader :world

  def initialize
    @world = YPetri::World.new
    super
  end
end # module YPetri::Agent

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
y_petri-2.4.9 lib/y_petri/agent.rb
y_petri-2.4.8 lib/y_petri/agent.rb
y_petri-2.4.6 lib/y_petri/agent.rb
y_petri-2.4.4 lib/y_petri/agent.rb
y_petri-2.4.3 lib/y_petri/agent.rb
y_petri-2.4.2 lib/y_petri/agent.rb
y_petri-2.4.0 lib/y_petri/agent.rb
y_petri-2.3.12 lib/y_petri/agent.rb
y_petri-2.3.11 lib/y_petri/agent.rb