Exemple #1
0
// Returns a modified weight
func (m Weight) mutateWeight(rng *rand.Rand, c *neat.Connection) {
	c.Weight += rng.NormFloat64()
	/*
		if w < -m.WeightRange*2 {
			w = -m.WeightRange * 2
		} else if w > m.WeightRange*2 {
			w = m.WeightRange * 2
		}
	*/
}
Exemple #2
0
// Returns a new weight
func (m Weight) replaceWeight(rng *rand.Rand, c *neat.Connection) {
	c.Weight = (rng.Float64()*2.0 - 1.0) * m.WeightRange()
}