Sha256: 567b12fc76cdd08c4f722540b8e0d09066a703052d66b710379015f532bae1c7
Contents?: true
Size: 295 Bytes
Versions: 2
Compression:
Stored size: 295 Bytes
Contents
=begin rdoc Basic xor function we shall evolve a net for. Only goes true on one and only one true input, false otherwise. == Note Well This function can either take 0 or -1 to signify "false". =end def xor(*inp) inp.map{|n| (n > 0) ? 1 : 0}.reduce {|p, i| p + ((i > 0) ? 1 : 0) } == 1 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubyneat-0.3.5.alpha.3 | neater/rnlib/xor.rb |
rubyneat-0.3.5.alpha.2 | neater/rnlib/xor.rb |