mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 08:52:42 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user