forked from sarah/microworlds
Actuall commit Snowball*
This commit is contained in:
parent
9fe42b1ff2
commit
c33995d256
|
@ -12,7 +12,7 @@ type Snowball struct {
|
||||||
sureness float32
|
sureness float32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *Snowball) Snowball(env *core.Environment, t *core.Turtle) {
|
func (sm *Snowball) Setup(env *core.Environment, t *core.Turtle) {
|
||||||
num := rand.Intn(100)
|
num := rand.Intn(100)
|
||||||
if num >= int(sm.Probability*100.0) {
|
if num >= int(sm.Probability*100.0) {
|
||||||
sm.color = 2
|
sm.color = 2
|
||||||
|
|
2
main.go
2
main.go
|
@ -103,7 +103,7 @@ func main() {
|
||||||
g.ColorPheromone("2", [4]uint8{0xFF, 0, 0xFF, 0x00})
|
g.ColorPheromone("2", [4]uint8{0xFF, 0, 0xFF, 0x00})
|
||||||
case "snowball":
|
case "snowball":
|
||||||
for i := 0; i < *numTurtles; i++ {
|
for i := 0; i < *numTurtles; i++ {
|
||||||
turtles[i] = core.NewTurtle(env, &actors.Slush{Probability:float32(*prob)})
|
turtles[i] = core.NewTurtle(env, &actors.Snowball{Probability:float32(*prob)})
|
||||||
}
|
}
|
||||||
env.InitPheromone("1")
|
env.InitPheromone("1")
|
||||||
env.InitPheromone("2")
|
env.InitPheromone("2")
|
||||||
|
|
Loading…
Reference in New Issue