Fix: cookie; add llm parser interface

This commit is contained in:
Grail Finder
2025-06-12 11:21:39 +03:00
parent 74b10b8395
commit 60d62773b8
6 changed files with 144 additions and 49 deletions

View File

@ -103,6 +103,15 @@ func (r *Room) CanStart() error {
return nil
}
func getGuesser(m map[string]BotPlayer, team UserTeam) string {
for k, v := range m {
if v.Team == team && v.Role == UserRoleGuesser {
return k
}
}
return ""
}
// WhichBotToMove returns bot name that have to move or empty string
func (r *Room) WhichBotToMove() string {
fmt.Println("looking for bot to move", "team-turn", r.TeamTurn, "mime-done", r.MimeDone, "bot-map", r.BotMap, "is_running", r.IsRunning)
@ -116,16 +125,18 @@ func (r *Room) WhichBotToMove() string {
if ok {
return r.BlueTeam.Mime
}
} else {
return getGuesser(r.BotMap, UserTeamBlue)
}
// check gussers
case UserTeamRed:
if !r.MimeDone {
_, ok := r.BotMap[r.RedTeam.Mime]
if ok {
return r.RedTeam.Mime
}
} else {
return getGuesser(r.BotMap, UserTeamRed)
}
// check gussers
default:
// how did we got here?
return ""