Feat: card counter

This commit is contained in:
Grail Finder
2025-05-10 14:35:24 +03:00
parent 35e215e26f
commit 321b79b258
6 changed files with 51 additions and 0 deletions

View File

@ -62,6 +62,34 @@ type Room struct {
IsOver bool
}
func (r *Room) GetOppositeTeamColor() string {
switch r.TeamTurn {
case "red":
return "blue"
case "blue":
return "red"
}
return ""
}
func (r *Room) UpdateCounter() {
redCounter := uint8(0)
blueCounter := uint8(0)
for _, card := range r.Cards {
if card.Revealed {
continue
}
switch card.Color {
case WordColorRed:
redCounter++
case WordColorBlue:
blueCounter++
}
}
r.RedCounter = redCounter
r.BlueCounter = blueCounter
}
func (r *Room) LoadTestCards() {
cards := []WordCard{
{Word: "hamster", Color: "blue"},