initial commit

This commit is contained in:
Daniel Noulet 2026-10-07 15:16:00 +02:00
commit ac9aa86d33
14 changed files with 1021 additions and 0 deletions

30
internal/game/bot.go Normal file
View file

@ -0,0 +1,30 @@
package game
import "math/rand"
type Bot struct {
Player
}
func NewBot(id, name string) *Bot {
return &Bot{
Player: *NewPlayer(id, name),
}
}
func (b *Bot) ChooseRank(hand []Card) Rank {
// Bot simply picks a random card rank from its hand
if len(hand) == 0 {
return RankAce
}
idx := rand.Intn(len(hand))
return hand[idx].Rank
}
func (b *Bot) ChooseCardToAsk(availableRanks []Rank) Rank {
if len(availableRanks) > 0 {
idx := rand.Intn(len(availableRanks))
return availableRanks[idx]
}
return RankAce
}