Make pythag really slow
This commit is contained in:
@@ -98,7 +98,7 @@ func (def *Definition) Grow(statusChan chan<- Status) (*vm.Program, error) {
|
||||
statusChan <- status
|
||||
}
|
||||
|
||||
if status.BestScores[0].Current == status.BestScores[0].Total {
|
||||
if def.scoreIsPerfect(status.BestScores) {
|
||||
return prog, nil
|
||||
}
|
||||
}
|
||||
@@ -225,6 +225,16 @@ func (def *Definition) scoreIsBetter(old, new []*Score) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (def *Definition) scoreIsPerfect(scores []*Score) bool {
|
||||
for _, score := range scores {
|
||||
if score.Current < score.Total {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (def *Definition) minifyProgram(prog *vm.Program) error {
|
||||
for f := 0; f < len(prog.Functions); f++ {
|
||||
err := def.minifyFunction(prog, f)
|
||||
|
||||
Reference in New Issue
Block a user