Feat: clear marks after end of the turn
This commit is contained in:
		| @@ -83,6 +83,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | |||||||
| 		fi.Room.MimeDone = false | 		fi.Room.MimeDone = false | ||||||
| 		fi.Room.OpenedThisTurn = 0 | 		fi.Room.OpenedThisTurn = 0 | ||||||
| 		fi.Room.ThisTurnLimit = 0 | 		fi.Room.ThisTurnLimit = 0 | ||||||
|  | 		fi.Room.ClearMarks() | ||||||
| 	} | 	} | ||||||
| 	switch string(color) { | 	switch string(color) { | ||||||
| 	case "black": | 	case "black": | ||||||
| @@ -100,6 +101,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | |||||||
| 		fi.Room.OpenedThisTurn = 0 | 		fi.Room.OpenedThisTurn = 0 | ||||||
| 		fi.Room.ThisTurnLimit = 0 | 		fi.Room.ThisTurnLimit = 0 | ||||||
| 		fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | 		fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | ||||||
|  | 		fi.Room.ClearMarks() | ||||||
| 	case "white", string(oppositeColor): | 	case "white", string(oppositeColor): | ||||||
| 		log.Debug("opened opposite color word", "room", fi.Room, "opposite-color", oppositeColor) | 		log.Debug("opened opposite color word", "room", fi.Room, "opposite-color", oppositeColor) | ||||||
| 		// end turn | 		// end turn | ||||||
| @@ -120,6 +122,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | |||||||
| 				Action:     models.ActionTypeGameOver, | 				Action:     models.ActionTypeGameOver, | ||||||
| 			} | 			} | ||||||
| 			fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | 			fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | ||||||
|  | 			fi.Room.ClearMarks() | ||||||
| 		} | 		} | ||||||
| 		if fi.Room.RedCounter == 0 { | 		if fi.Room.RedCounter == 0 { | ||||||
| 			// red won | 			// red won | ||||||
| @@ -133,6 +136,7 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | |||||||
| 				Action:     models.ActionTypeGameOver, | 				Action:     models.ActionTypeGameOver, | ||||||
| 			} | 			} | ||||||
| 			fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | 			fi.Room.ActionHistory = append(fi.Room.ActionHistory, action) | ||||||
|  | 			fi.Room.ClearMarks() | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if err := saveFullInfo(fi); err != nil { | 	if err := saveFullInfo(fi); err != nil { | ||||||
|   | |||||||
| @@ -193,7 +193,7 @@ func (b *Bot) BotMove() { | |||||||
| 	case models.UserRoleMime: | 	case models.UserRoleMime: | ||||||
| 		mimeResp := MimeResp{} | 		mimeResp := MimeResp{} | ||||||
| 		b.log.Info("mime resp log", "mimeResp", tempMap) | 		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) | 		mimeResp.Number = tempMap["number"].(string) | ||||||
| 		action := models.Action{ | 		action := models.Action{ | ||||||
| 			Actor:      b.BotName, | 			Actor:      b.BotName, | ||||||
|   | |||||||
| @@ -99,6 +99,12 @@ type Room struct { | |||||||
| 	LogJournal []string | 	LogJournal []string | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func (r *Room) ClearMarks() { | ||||||
|  | 	for i, _ := range r.Cards { | ||||||
|  | 		r.Cards[i].Mark = []CardMark{} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| func (r *Room) RemovePlayer(username string) { | func (r *Room) RemovePlayer(username string) { | ||||||
| 	r.RedTeam.Guessers = utils.RemoveFromSlice(username, r.RedTeam.Guessers) | 	r.RedTeam.Guessers = utils.RemoveFromSlice(username, r.RedTeam.Guessers) | ||||||
| 	r.BlueTeam.Guessers = utils.RemoveFromSlice(username, r.BlueTeam.Guessers) | 	r.BlueTeam.Guessers = utils.RemoveFromSlice(username, r.BlueTeam.Guessers) | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								todos.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								todos.md
									
									
									
									
									
								
							| @@ -11,16 +11,19 @@ | |||||||
| - autoscroll down backlog on update; + | - autoscroll down backlog on update; + | ||||||
| - instead of guessing all words at ones, ask only for 1 word to be open. + | - instead of guessing all words at ones, ask only for 1 word to be open. + | ||||||
| - ways to remove bots from teams; + | - 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; | - better styles and fluff; | ||||||
| - common auth system between sites; | - 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; | - gameover to backlog; | ||||||
| - cleanup backlog after new game is started; | - cleanup backlog after new game is started; | ||||||
| - ended turn action to backlog; | - ended turn action to backlog; | ||||||
|  | === | ||||||
| - clear indication that model (llm) is thinking / answered; | - clear indication that model (llm) is thinking / answered; | ||||||
| - different files for each supported lang; | - different files for each supported lang; | ||||||
| - mark cards (instead of opening them (right click?); | - possibly turn markings into parts of names of users (first three letters?); | ||||||
| - on end of turn clear all the marks; |  | ||||||
|  |  | ||||||
| #### sse points | #### sse points | ||||||
| - clue sse update; | - clue sse update; | ||||||
| @@ -43,10 +46,11 @@ | |||||||
| - remove bot does not remove for player roles in the room; + | - 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); + | - 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; + | - 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); | - 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; | - invite link gets cutoff; | ||||||
| - guesser bot no request after game restart; | - 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; | - openrouter 429 errors; | ||||||
| - there is a clue window for a mime before game started; | - there is a clue window for a mime before game started; | ||||||
| - retry call to llm (if 400|429|4xx); | - retry call to llm (if 400|429|4xx); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder