Enha: style update

This commit is contained in:
Grail Finder
2025-06-23 10:22:07 +03:00
parent 23cbde0f7a
commit 2fcc36be51
4 changed files with 12 additions and 27 deletions

View File

@ -1,27 +1,11 @@
{{define "cardword"}} {{define "cardword"}}
{{if .Revealed}} {{if .Revealed}}
<div id="card-{{.Word}}" style=" <div id="card-{{.Word}}" class="bg-{{.Color}}-600 p-4 rounded-lg min-w-[100px] text-center text-white cursor-pointer"
background-color: {{.Color}}; style="text-shadow: 0 2px 4px rgba(0,0,0,0.8);"> {{.Word}}
padding: 1rem;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
min-width: 100px;
text-align: center;
color: white;
text-shadow: 0 2px 4px rgba(0,0,0,0.8);
cursor: pointer;"> {{.Word}}
</div> </div>
{{else}} {{else}}
<div id="card-{{.Word}}" style=" <div id="card-{{.Word}}" class="bg-stone-600 p-4 rounded-lg min-w-[100px] text-center text-white cursor-pointer"
background-color: #e4d5b7; style="text-shadow: 0 2px 4px rgba(0,0,0,0.8);"
padding: 1rem;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
min-width: 100px;
text-align: center;
color: white;
text-shadow: 0 2px 4px rgba(0,0,0,0.8);
cursor: pointer;"
hx-get="/word/show-color?word={{.Word}}" hx-trigger="click" hx-swap="outerHTML transition:true swap:.05s"> hx-get="/word/show-color?word={{.Word}}" hx-trigger="click" hx-swap="outerHTML transition:true swap:.05s">
{{.Word}} {{.Word}}
</div> </div>

View File

@ -356,8 +356,6 @@ func recoverPlayer(pm map[string]string) error {
if !ok { if !ok {
return fmt.Errorf("failed to find player %s in the room %v", pm["Username"], room) return fmt.Errorf("failed to find player %s in the room %v", pm["Username"], room)
} }
// pm["Role"] = string(role)
// pm["Team"] = string(team)
us := &models.UserState{ us := &models.UserState{
Username: pm["Username"], Username: pm["Username"],
RoomID: pm["RoomID"], RoomID: pm["RoomID"],

View File

@ -24,7 +24,7 @@ var (
MimePrompt = `we are playing alias;\nyou are a mime (player who gives a clue of one noun word and number of cards you expect them to open) of the %s team (people who would guess by your clue want open the %s cards);\nplease return your clue, number of cards to open and what words you mean them to find using that clue in json like:\n{\n\"clue\": \"one-word-noun\",\n\"number\": \"number-from-0-to-9\",\n\"words_I_mean_my_team_to_open\": [\"this\", \"that\", ...]\n}\nthe team who openes all their cards first wins.\nplease return json only.\nunopen Blue cards left: %d;\nunopen Red cards left: %d;\nhere is the game info in json:\n%s` MimePrompt = `we are playing alias;\nyou are a mime (player who gives a clue of one noun word and number of cards you expect them to open) of the %s team (people who would guess by your clue want open the %s cards);\nplease return your clue, number of cards to open and what words you mean them to find using that clue in json like:\n{\n\"clue\": \"one-word-noun\",\n\"number\": \"number-from-0-to-9\",\n\"words_I_mean_my_team_to_open\": [\"this\", \"that\", ...]\n}\nthe team who openes all their cards first wins.\nplease return json only.\nunopen Blue cards left: %d;\nunopen Red cards left: %d;\nhere is the game info in json:\n%s`
// TODO: simplify; bot gets confused; so show it only unrevealed cards and last clue (maybe older clues as well); // TODO: simplify; bot gets confused; so show it only unrevealed cards and last clue (maybe older clues as well);
GuesserPrompt = `we are playing alias;\nyou are to guess words of the %s team (you want open %s cards) by given clue and a number of meant guesses;\nplease return your guesses and words that could be meant by the clue, but you do not wish to open yet, in json like:\n{\n\"guesses\": [\"word1\", \"word2\", ...],\n\"could_be\": [\"this\", \"that\", ...]\n}\nthe team who openes all their cards first wins.\nplease return json only.\nunopen Blue cards left: %d;\nunopen Red cards left: %d;\nhere is the cards (and other info), you need to choose revealed==false words:\n%s` GuesserPrompt = `we are playing alias;\nyou are to guess words of the %s team (you want open %s cards) by given clue and a number of meant guesses;\nplease return your guesses and words that could be meant by the clue, but you do not wish to open yet, in json like:\n{\n\"guesses\": [\"word1\", \"word2\", ...],\n\"could_be\": [\"this\", \"that\", ...]\n}\nthe team who openes all their cards first wins.\nplease return json only.\nunopen Blue cards left: %d;\nunopen Red cards left: %d;\nhere is the cards (and other info), you need to choose revealed==false words:\n%s`
GuesserSimplePrompt = `we are playing game of alias;\n you were given a clue: \"%s\";\nplease return your guess and words that could be meant by the clue, but you do not wish to open yet, in json like:\n{\n\"guess\": "most_relevant_word_to_the_clue",\n\"could_be\": [\"this\", \"that\", ...]\n}\nhere is the words that left:\n%s` GuesserSimplePrompt = `we are playing game of alias;\n you were given a clue: \"%s\";\nplease return your guess and words that could be meant by the clue, but you do not wish to open yet, in json like:\n{\n\"guess\": \"most_relevant_word_to_the_clue\",\n\"could_be\": [\"this\", \"that\", ...]\n}\nhere is the words that left:\n%s`
) )
type DSResp struct { type DSResp struct {
@ -254,6 +254,8 @@ func (b *Bot) StartBot() {
room.LogJournal = append(room.LogJournal, fmt.Sprintf("%s also considered this: %v", b.BotName, couldBe)) room.LogJournal = append(room.LogJournal, fmt.Sprintf("%s also considered this: %v", b.BotName, couldBe))
eventName = models.NotifyRoomUpdatePrefix + room.ID eventName = models.NotifyRoomUpdatePrefix + room.ID
eventPayload = "" eventPayload = ""
// TODO: needs to decide if it wants to open the next cardword or end turn
// or end turn on limit
default: default:
b.log.Error("unexpected role", "role", b.Role, "resp-map", tempMap) b.log.Error("unexpected role", "role", b.Role, "resp-map", tempMap)
continue continue
@ -263,6 +265,7 @@ func (b *Bot) StartBot() {
b.log.Error("failed to save room", "error", err) b.log.Error("failed to save room", "error", err)
continue continue
} }
// will it notify itself?
if botName := room.WhichBotToMove(); botName != "" { if botName := room.WhichBotToMove(); botName != "" {
SignalChanMap[botName] <- true SignalChanMap[botName] <- true
} }

View File

@ -12,16 +12,16 @@ import (
type WordColor string type WordColor string
const ( const (
WordColorWhite = "white" WordColorWhite = "amber"
WordColorBlue = "blue" WordColorBlue = "blue"
WordColorRed = "red" WordColorRed = "red"
WordColorBlack = "black" WordColorBlack = "black"
WordColorUknown = "beige" WordColorUknown = "stone" // beige
) )
func StrToWordColor(s string) WordColor { func StrToWordColor(s string) WordColor {
switch s { switch s {
case "white": case "amber", "white":
return WordColorWhite return WordColorWhite
case "blue": case "blue":
return WordColorBlue return WordColorBlue