From 849fcba974bdf2424f42c427f1a195323f07fc01 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sun, 29 Jun 2025 09:40:21 +0300 Subject: [PATCH] Feat: clear marks after end of the turn --- handlers/elements.go | 4 ++++ llmapi/main.go | 2 +- models/main.go | 6 ++++++ todos.md | 12 ++++++++---- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/handlers/elements.go b/handlers/elements.go index 0494ad9..4fe08ee 100644 --- a/handlers/elements.go +++ b/handlers/elements.go @@ -83,6 +83,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { fi.Room.MimeDone = false fi.Room.OpenedThisTurn = 0 fi.Room.ThisTurnLimit = 0 + fi.Room.ClearMarks() } switch string(color) { case "black": @@ -100,6 +101,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { fi.Room.OpenedThisTurn = 0 fi.Room.ThisTurnLimit = 0 fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) + fi.Room.ClearMarks() case "white", string(oppositeColor): log.Debug("opened opposite color word", "room", fi.Room, "opposite-color", oppositeColor) // end turn @@ -120,6 +122,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { Action: models.ActionTypeGameOver, } fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) + fi.Room.ClearMarks() } if fi.Room.RedCounter == 0 { // red won @@ -133,6 +136,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { Action: models.ActionTypeGameOver, } fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) + fi.Room.ClearMarks() } } if err := saveFullInfo(fi); err != nil { diff --git a/llmapi/main.go b/llmapi/main.go index 5e24b37..021015e 100644 --- a/llmapi/main.go +++ b/llmapi/main.go @@ -193,7 +193,7 @@ func (b *Bot) BotMove() { case models.UserRoleMime: mimeResp := MimeResp{} b.log.Info("mime resp log", "mimeResp", tempMap) - mimeResp.Clue = tempMap["clue"].(string) + mimeResp.Clue = strings.ToLower(tempMap["clue"].(string)) mimeResp.Number = tempMap["number"].(string) action := models.Action{ Actor: b.BotName, diff --git a/models/main.go b/models/main.go index d133767..a1cd566 100644 --- a/models/main.go +++ b/models/main.go @@ -99,6 +99,12 @@ type Room struct { LogJournal []string } +func (r *Room) ClearMarks() { + for i, _ := range r.Cards { + r.Cards[i].Mark = []CardMark{} + } +} + func (r *Room) RemovePlayer(username string) { r.RedTeam.Guessers = utils.RemoveFromSlice(username, r.RedTeam.Guessers) r.BlueTeam.Guessers = utils.RemoveFromSlice(username, r.BlueTeam.Guessers) diff --git a/todos.md b/todos.md index 3987743..660b8a0 100644 --- a/todos.md +++ b/todos.md @@ -11,16 +11,19 @@ - autoscroll down backlog on update; + - instead of guessing all words at ones, ask only for 1 word to be open. + - ways to remove bots from teams; + -- show in backlog (and with that in prompt to llm) how many cards are left to open, also additional comment: if guess was right; +- mark cards (instead of opening them (right click?); + +- on end of turn clear all the marks; + - better styles and fluff; - common auth system between sites; +=== +- show in backlog (and with that in prompt to llm) how many cards are left to open, also additional comment: if guess was right; - gameover to backlog; - cleanup backlog after new game is started; - ended turn action to backlog; +=== - clear indication that model (llm) is thinking / answered; - different files for each supported lang; -- mark cards (instead of opening them (right click?); -- on end of turn clear all the marks; +- possibly turn markings into parts of names of users (first three letters?); #### sse points - clue sse update; @@ -43,10 +46,11 @@ - remove bot does not remove for player roles in the room; + - guesser did not have same number of guesses (move ended after 1 guess); show how much guesses left on the page (red after blue); + - 0 should mean without limit; + +- remove join as mime button if there is a mime already on that team (rewrite teampew templ); + +- bot clues to lowercase; + - sse hangs / fails connection which causes to wait for cards to open a few seconds (on local machine) (did not reoccur so far); - invite link gets cutoff; - guesser bot no request after game restart; -- remove join as mime button if there is a mime already on that team (rewrite teampew templ); - openrouter 429 errors; - there is a clue window for a mime before game started; - retry call to llm (if 400|429|4xx);