Feat: save room even if llm failed to properly guess; fix prompt
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder