Class: NEAT::Critter::Phenotype
- Includes:
- Math
- Defined in:
- lib/rubyneat/critter.rb
Overview
Phenotype part of the Critter
This is created by Evolver.
Instance Attribute Summary collapse
-
#code ⇒ Object
Expressed code as a string (that was instance_eval()ed).
-
#critter ⇒ Object
Critter to which we belong.
Attributes inherited from NeatOb
Class Method Summary collapse
Instance Method Summary collapse
-
#express! ⇒ Object
Take what is in code and express that!.
-
#stimulate ⇒ Object
This function is re-written by Expressor – with parameters and all.
-
#to_s ⇒ Object
This gives us a complete.
Methods inherited from NeatOb
attr_neat, #initialize, log, #log
Constructor Details
This class inherits a constructor from NEAT::NeatOb
Instance Attribute Details
#code ⇒ Object
Expressed code as a string (that was instance_eval()ed)
292 293 294 |
# File 'lib/rubyneat/critter.rb', line 292 def code @code end |
#critter ⇒ Object
Critter to which we belong
289 290 291 |
# File 'lib/rubyneat/critter.rb', line 289 def critter @critter end |
Class Method Details
.[](critter) ⇒ Object
294 295 296 297 298 299 |
# File 'lib/rubyneat/critter.rb', line 294 def self.[](critter) ph = Phenotype.new critter.controller ph.critter = critter ph.code = "## Phenotype Code %s for critter %s\n" % [ph.name, critter.name] return ph end |
Instance Method Details
#express! ⇒ Object
Take what is in code and express that!
302 303 304 305 |
# File 'lib/rubyneat/critter.rb', line 302 def express! instance_eval @code self end |
#stimulate ⇒ Object
This function is re-written by Expressor – with parameters and all. It returns a “response” in the form of a response hash. TODO This is network activation, so we should rename this at a later date…
310 311 312 |
# File 'lib/rubyneat/critter.rb', line 310 def stimulate nil end |
#to_s ⇒ Object
This gives us a complete
315 316 317 |
# File 'lib/rubyneat/critter.rb', line 315 def to_s "## %s\n%s" % [super, @code] end |