Update predator logic

This commit is contained in:
Sarah Jamie Lewis 2019-09-28 16:39:28 -07:00
parent b9383f8f94
commit 1f7a87bba7
1 changed files with 7 additions and 7 deletions

View File

@ -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)
}