Feat: save room even if llm failed to properly guess; fix prompt

This commit is contained in:
Grail Finder
2025-06-26 11:36:27 +03:00
parent 661a320fb5
commit 12fe92b261
7 changed files with 134 additions and 117 deletions

View File

@ -19,6 +19,15 @@ const (
WordColorUknown = "stone" // beige
)
type ActionType string
const (
ActionTypeClue = "gave_clue"
ActionTypeGuess = "guessed"
ActionTypeGameOver = "game_over"
ActionTypeGameStarted = "game_started"
)
func StrToWordColor(s string) WordColor {
switch s {
case "amber", "white":
@ -88,6 +97,15 @@ type Room struct {
LogJournal []string
}
func (r *Room) FetchLastClue() (*Action, error) {
for i := len(r.ActionHistory) - 1; i >= 0; i-- {
if r.ActionHistory[i].Action == string(ActionTypeClue) {
return &r.ActionHistory[i], nil
}
}
return nil, errors.New("no clue in history")
}
func (r *Room) GetPlayerByName(name string) (role UserRole, team UserTeam, found bool) {
if r.RedTeam.Mime == name {
return "mime", "red", true