Actuall commit Snowball*

This commit is contained in:
Sarah Jamie Lewis 2019-08-10 17:29:46 -07:00
parent 9fe42b1ff2
commit c33995d256
2 changed files with 2 additions and 2 deletions

View File

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

View File

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