Class: Wallace::Species::BitStringSpecies

Inherits:
ArraySpecies show all
Defined in:
lib/species/bit_string_species.rb

Overview

Bit-strings are implemented as a specialised form of array species that are confined to only containing 0 and 1 integers.

Instance Attribute Summary

Attributes inherited from Wallace::Species

#id

Instance Method Summary collapse

Methods inherited from ArraySpecies

#spawn, #valid?

Methods inherited from Wallace::Species

#finish!, #spawn, #valid?

Constructor Details

#initialize(opts = {}) ⇒ BitStringSpecies

Constructs a new bit-string based species.

Parameters:

  • opts, hash of keyword options used by this method. -> id, the unique identifier for this species. -> length, the length constraints imposed on individuals of this species.



13
14
15
16
# File 'lib/species/bit_string_species.rb', line 13

def initialize(opts = {})
  opts[:length] = [0, 1]
  super(opts)
end