Update predator logic
This commit is contained in:
parent
b9383f8f94
commit
1f7a87bba7
|
@ -10,22 +10,22 @@ import (
|
|||
"math/rand"
|
||||
)
|
||||
|
||||
var numPrey = flag.Int("numPrey", 1200, "the number of prey")
|
||||
var numPrey = flag.Int("numPrey", 300, "the number of prey")
|
||||
|
||||
var initialPreyEnergy = flag.Int("initialPreyEnergy", 20, "initial prey energy")
|
||||
var initialPreyEnergy = flag.Int("initialPreyEnergy", 15, "initial prey energy")
|
||||
var preyMaxLife = flag.Int("preyMaxLife", 25, "the max lifespan of prey (in simulation steps)")
|
||||
var preyReproductiveAge = flag.Int("preyReproductiveAge", 4, "the age a prey might reproduce")
|
||||
var preyReproductionEnergy = flag.Int("preyReproductionEnergy", 4, "energy required for prey reproduction")
|
||||
var preyReproductionProbability = flag.Float64("preyReproductionProbability", 0.5, "preys probability of reproducing")
|
||||
var preyReproductionProbability = flag.Float64("preyReproductionProbability", 0.4, "preys probability of reproducing")
|
||||
|
||||
|
||||
|
||||
var numPred = flag.Int("numPred", 30, "the number of predators")
|
||||
var initialPredatorEnergy = flag.Int("initialPredatorEnergy", 30, "initial predator energy")
|
||||
var predatorMaxLife = flag.Int("predatorMaxLife", 40, "the max lifespan of predators (in simulation steps)")
|
||||
var initialPredatorEnergy = flag.Int("initialPredatorEnergy", 40, "initial predator energy")
|
||||
var predatorMaxLife = flag.Int("predatorMaxLife", 60, "the max lifespan of predators (in simulation steps)")
|
||||
var predatorMaxEnergy = flag.Int("predatorMaxEnergy", 30, "max amount of energy a predator can have")
|
||||
var predatorReproductionEnergy = flag.Int("predatorReproductionEnergy", 50, "predator reproductive energy")
|
||||
var predatorReproductionProbability = flag.Float64("predatorReproductionProbability", 0.1, "predators probability of reproducing")
|
||||
var predatorReproductionProbability = flag.Float64("predatorReproductionProbability", 0.05, "predators probability of reproducing")
|
||||
|
||||
|
||||
type Predator struct {
|
||||
|
@ -60,7 +60,7 @@ func (sm *Predator) Run(env *core.Environment, t *core.Turtle) {
|
|||
sm.Energy = int(math.Max(float64(sm.Energy)+10, float64(*predatorMaxEnergy)))
|
||||
}
|
||||
}
|
||||
t.FollowGradient(env, 1, 3, "scent")
|
||||
t.FollowGradient(env, 3, 1, "scent")
|
||||
t.Step(env)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue