Support multiple scoring criteria

This commit is contained in:
Ian Gulliver
2021-11-24 19:52:22 -08:00
parent 7c0a1e28e6
commit 1c4cf25e34
5 changed files with 176 additions and 79 deletions

View File

@@ -1,9 +1,11 @@
package main
import "flag"
import "fmt"
import "log"
import "math/rand"
import "os"
import "strings"
import "time"
import "github.com/firestuff/subcoding/asm"
@@ -54,6 +56,16 @@ func main() {
log.Fatal(err)
}
log.Printf("New best score %d / %d (after %d attempts):\n%s", status.BestScore, status.TargetScore, status.Attempts, src)
log.Printf("New best score [%s] after %d attempts:\n%s", scoreString(status.BestScores), status.Attempts, src)
}
}
func scoreString(scores []*grow.Score) string {
strs := []string{}
for _, score := range scores {
strs = append(strs, fmt.Sprintf("%d / %d", score.Current, score.Total))
}
return strings.Join(strs, ", ")
}