Support multiple scoring criteria
This commit is contained in:
@@ -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, ", ")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user