Class: NEAT::Critter::Phenotype

Inherits:
NeatOb
  • Object
show all
Includes:
Math
Defined in:
lib/rubyneat/critter.rb

Overview

Phenotype part of the Critter

This is created by Evolver.

Instance Attribute Summary collapse

Attributes inherited from NeatOb

#controller, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NeatOb

attr_neat, #initialize, log, #log

Constructor Details

This class inherits a constructor from NEAT::NeatOb

Instance Attribute Details

#codeObject

Expressed code as a string (that was instance_eval()ed)



292
293
294
# File 'lib/rubyneat/critter.rb', line 292

def code
  @code
end

#critterObject

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

#stimulateObject

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_sObject

This gives us a complete



315
316
317
# File 'lib/rubyneat/critter.rb', line 315

def to_s
  "## %s\n%s" % [super, @code]
end