Improve AI difficulty scaling.
This commit is contained in:
@@ -254,6 +254,26 @@ func TestSimulateBattleIsPure(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestBlunderCurve pins the difficulty calibration's shape: only sub-competent
|
||||
// bots ever throw a game on purpose, and they do so more the weaker they are.
|
||||
// Medium (== competentLevel) and hard must never blunder, or they would not be
|
||||
// the even-match / favourite the difficulty design promises.
|
||||
func TestBlunderCurve(t *testing.T) {
|
||||
if p := blunderProb(competentLevel); p != 0 {
|
||||
t.Errorf("competent bot blunders with p=%.3f, want 0", p)
|
||||
}
|
||||
if p := blunderProb(1.0); p != 0 {
|
||||
t.Errorf("hard bot blunders with p=%.3f, want 0", p)
|
||||
}
|
||||
weakest, easy := blunderProb(0), blunderProb(0.25)
|
||||
if !(weakest > easy && easy > 0) {
|
||||
t.Errorf("blunder rate must rise as level falls: level0=%.3f easy=%.3f", weakest, easy)
|
||||
}
|
||||
if weakest > 1 {
|
||||
t.Errorf("blunder probability %.3f exceeds 1", weakest)
|
||||
}
|
||||
}
|
||||
|
||||
// TestDecideShopNeverSellsLastPet guards the invariant that the bot never
|
||||
// voluntarily turns its whole deck into food. In a hopeless late-game spot
|
||||
// (final round, a strong modeled opponent, so every rollout is a loss) the
|
||||
|
||||
Reference in New Issue
Block a user