diff --git a/cardsim/rules.go b/cardsim/rules.go index 02d44e8..b98d071 100644 --- a/cardsim/rules.go +++ b/cardsim/rules.go @@ -141,7 +141,7 @@ func (r *RuleCollection[C]) performInsert(k *keyedRule[C]) { r.rules[k.id] = k s := r.byStep[k.Step()] - if s == nil { + if len(s) == 0 { r.steps = nil } s = append(s, k.id) @@ -326,7 +326,7 @@ func (r *RuleCollection[C]) Run(p *Player[C]) error { steps := r.steps if steps == nil { // Step set changed, recalculate. - steps := make([]int, 0, len(r.byStep)) + steps = make([]int, 0, len(r.byStep)) for step := range r.byStep { steps = append(steps, step) }