Feat: clear marks after end of the turn

This commit is contained in:
Grail Finder
2025-06-29 09:40:21 +03:00
parent 5b666e042a
commit 849fcba974
4 changed files with 19 additions and 5 deletions

View File

@ -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 {

View File

@ -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,

View File

@ -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)

View File

@ -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);