feat: add answer confidence differential as scoring factor
When both bots are correct, the one with higher checkAnswer confidence (exact match 1.0 vs fuzzy match 0.8) gets up to +1.0 bonus points. This rewards precise answers over approximate ones, adding another competitive dimension beyond pure speed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
cb8a45cfb3
commit
c6c792dd9e
@@ -218,6 +218,25 @@ describe('scoreRound', () => {
|
||||
expect(typeof result.narration).toBe('string')
|
||||
expect(result.narration.length).toBeGreaterThan(10)
|
||||
})
|
||||
|
||||
it('answer confidence gives bonus — exact match (1.0) beats fuzzy match (0.8)', () => {
|
||||
// Use answers where one answer is a substring of another
|
||||
// "satoshi" against ["satoshi nakamoto"] scores 0.8 (containment)
|
||||
// "satoshi nakamoto" against ["satoshi nakamoto"] scores 1.0 (exact)
|
||||
const challenge = makeChallenge({ answers: ['satoshi nakamoto'] })
|
||||
|
||||
// Both answer at equal speed, but A has exact match, B has fuzzy
|
||||
const result = scoreRound(
|
||||
challenge, botA, botB,
|
||||
makeResponse('satoshi nakamoto', 500), // exact → 1.0
|
||||
makeResponse('nakamoto', 500), // contained → 0.8
|
||||
null, 0, 0,
|
||||
)
|
||||
|
||||
// A should score higher due to confidence differential
|
||||
expect(result.botAScore).toBeGreaterThan(result.botBScore)
|
||||
expect(result.winnerId).toBe('a1')
|
||||
})
|
||||
})
|
||||
|
||||
describe('calculateElo', () => {
|
||||
|
||||
Reference in New Issue
Block a user