Class: Wallace::GE::GrammarSpecies
- Inherits:
-
Species::ArraySpecies
- Object
- Species
- Species::ArraySpecies
- Wallace::GE::GrammarSpecies
- Defined in:
- lib/modules/ge/grammar_species.rb
Overview
The grammar species represents each individual in the species as an array of integers which map to a derivation of the grammar attached to the species.
Instance Attribute Summary collapse
-
#grammar ⇒ Object
readonly
Returns the value of attribute grammar.
Attributes inherited from Species
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ GrammarSpecies
constructor
Constructs a new grammar-based species.
Methods inherited from Species::ArraySpecies
Methods inherited from Species
Constructor Details
#initialize(opts = {}) ⇒ GrammarSpecies
Constructs a new grammar-based species.
Parameters:
-
opts, hash of keyword options used by this method. -> id, the unique identifier for this species. -> grammar, the grammar used by individuals of this species. -> length, the length constraints on individuals of the species.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/modules/ge/grammar_species.rb', line 16 def initialize(opts = {}) # By default grammar derivations are between 10 and 200 symbols and contain # integers in the range 0 to 2147483647 inclusive. opts[:length] ||= 10..200 opts[:values] ||= 0..2147483647 super(opts) @grammar = opts[:grammar] end |
Instance Attribute Details
#grammar ⇒ Object (readonly)
Returns the value of attribute grammar.
7 8 9 |
# File 'lib/modules/ge/grammar_species.rb', line 7 def grammar @grammar end |