Converge Faster
This commit is contained in:
parent
8d91c2c06e
commit
653a0b4bd2
|
@ -19,7 +19,7 @@ func (sm *Snowball) Setup(env *core.Environment, t *core.Turtle) {
|
|||
} else {
|
||||
sm.color = 1
|
||||
}
|
||||
sm.sureness = 1
|
||||
sm.sureness = 2
|
||||
}
|
||||
|
||||
func (sm *Snowball) Run(env *core.Environment, t *core.Turtle) {
|
||||
|
@ -27,9 +27,6 @@ func (sm *Snowball) Run(env *core.Environment, t *core.Turtle) {
|
|||
am1 := t.Amount(env,1,"1")
|
||||
am2 := t.Amount(env,1,"2")
|
||||
|
||||
t.Drop(env, 1, strconv.Itoa(sm.color))
|
||||
|
||||
|
||||
if am1 > sm.sureness || am2 > sm.sureness {
|
||||
if am1 > am2 {
|
||||
if sm.color == 2 {
|
||||
|
@ -51,6 +48,11 @@ func (sm *Snowball) Run(env *core.Environment, t *core.Turtle) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if sm.sureness > 1 {
|
||||
t.Drop(env, 1, strconv.Itoa(sm.color))
|
||||
}
|
||||
|
||||
t.Step(env)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue