Add UNO sudden death and multiplayer bot turn announcements

2-player UNO (especially No Mercy) regularly stalls past 100 turns.
Sudden death announces at turn 80 with a 20-turn countdown, then
scores hands by card point values — lowest total wins. Applies to
solo (vs bot) and multiplayer when 2 active players remain.

Also adds "It's X's turn" labels to bot plays in multiplayer,
matching the format human plays already had, and adds sudden death
checks to all turn advancement paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-03-29 09:27:00 -07:00
parent 50cacd42c5
commit b188d7036b
4 changed files with 452 additions and 1 deletions

View File

@@ -26,6 +26,57 @@ func cardDrawValue(v unoValue) int {
}
}
// cardPointValue returns the point value of a card for sudden-death scoring.
func cardPointValue(c unoCard) int {
switch c.Value {
case unoZero:
return 0
case unoOne:
return 1
case unoTwo:
return 2
case unoThree:
return 3
case unoFour:
return 4
case unoFive:
return 5
case unoSix:
return 6
case unoSeven:
return 7
case unoEight:
return 8
case unoNine:
return 9
case unoSkip, unoReverse, unoDrawTwo:
return 20
case unoSkipEveryone, unoDrawFour, unoDiscardAll:
return 30
case unoWildCard, unoWildDrawFour:
return 50
case unoWildReverseDraw4, unoWildDrawSix, unoWildColorRoulette:
return 60
case unoWildDrawTen:
return 75
default:
return 0
}
}
func scoreHand(hand []unoCard) int {
total := 0
for _, c := range hand {
total += cardPointValue(c)
}
return total
}
func formatHandScore(hand []unoCard) string {
score := scoreHand(hand)
return fmt.Sprintf("%d cards, %d points", len(hand), score)
}
func isDrawCard(v unoValue) bool {
return cardDrawValue(v) > 0
}