Class: Ai::Neat::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/ai/neat/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNode

Returns a new instance of Node.



8
9
10
11
# File 'lib/ai/neat/node.rb', line 8

def initialize
  @value = 0
  @weights = []
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



6
7
8
# File 'lib/ai/neat/node.rb', line 6

def value
  @value
end

#weightsObject

Returns the value of attribute weights.



6
7
8
# File 'lib/ai/neat/node.rb', line 6

def weights
  @weights
end

Instance Method Details

#initWeights(count) ⇒ Object



13
14
15
16
17
# File 'lib/ai/neat/node.rb', line 13

def initWeights(count)
  (1..count).each do |_i|
    weights.push(rand(-1.0..1.0))
  end
end