Feat: ru words; make last clue more prominent
This commit is contained in:
@ -200,7 +200,6 @@ work
|
|||||||
cooperative
|
cooperative
|
||||||
practice
|
practice
|
||||||
executive
|
executive
|
||||||
woodruff
|
|
||||||
ultraviolet
|
ultraviolet
|
||||||
dream
|
dream
|
||||||
contradiction
|
contradiction
|
||||||
@ -448,9 +447,7 @@ feminine
|
|||||||
blonde
|
blonde
|
||||||
goodness
|
goodness
|
||||||
intellectual
|
intellectual
|
||||||
eve
|
|
||||||
client
|
client
|
||||||
why
|
|
||||||
vent
|
vent
|
||||||
vector
|
vector
|
||||||
lit
|
lit
|
||||||
@ -461,7 +458,6 @@ gold
|
|||||||
trail
|
trail
|
||||||
proprietor
|
proprietor
|
||||||
questionnaire
|
questionnaire
|
||||||
bob
|
|
||||||
pencil
|
pencil
|
||||||
consultant
|
consultant
|
||||||
envelope
|
envelope
|
||||||
@ -858,7 +854,6 @@ threshold
|
|||||||
upset
|
upset
|
||||||
bone
|
bone
|
||||||
billion
|
billion
|
||||||
peter
|
|
||||||
narrow
|
narrow
|
||||||
interest
|
interest
|
||||||
violation
|
violation
|
||||||
@ -1087,7 +1082,6 @@ future
|
|||||||
patch
|
patch
|
||||||
conformity
|
conformity
|
||||||
mystery
|
mystery
|
||||||
100
|
|
||||||
luncheon
|
luncheon
|
||||||
statesman
|
statesman
|
||||||
stability
|
stability
|
||||||
@ -1549,7 +1543,6 @@ rebel
|
|||||||
development
|
development
|
||||||
pro
|
pro
|
||||||
raise
|
raise
|
||||||
1000
|
|
||||||
sink
|
sink
|
||||||
value
|
value
|
||||||
discovery
|
discovery
|
||||||
@ -1906,7 +1899,6 @@ slate
|
|||||||
accuracy
|
accuracy
|
||||||
dilemma
|
dilemma
|
||||||
truck
|
truck
|
||||||
hart
|
|
||||||
capitol
|
capitol
|
||||||
husband
|
husband
|
||||||
now
|
now
|
||||||
@ -1916,7 +1908,6 @@ matter
|
|||||||
success
|
success
|
||||||
streetcar
|
streetcar
|
||||||
concentrate
|
concentrate
|
||||||
meantime
|
|
||||||
abuse
|
abuse
|
||||||
barrel
|
barrel
|
||||||
positive
|
positive
|
||||||
@ -2077,7 +2068,6 @@ sanction
|
|||||||
sail
|
sail
|
||||||
squeeze
|
squeeze
|
||||||
repeat
|
repeat
|
||||||
wally
|
|
||||||
store
|
store
|
||||||
yesterday
|
yesterday
|
||||||
killer
|
killer
|
||||||
@ -2826,7 +2816,6 @@ slip
|
|||||||
battle
|
battle
|
||||||
list
|
list
|
||||||
ethnic
|
ethnic
|
||||||
oersted
|
|
||||||
camera
|
camera
|
||||||
regular
|
regular
|
||||||
prospect
|
prospect
|
||||||
@ -2881,7 +2870,6 @@ transition
|
|||||||
portion
|
portion
|
||||||
counsel
|
counsel
|
||||||
complexity
|
complexity
|
||||||
rico
|
|
||||||
dough
|
dough
|
||||||
life
|
life
|
||||||
dose
|
dose
|
||||||
@ -3347,4 +3335,4 @@ accelerometer
|
|||||||
latest
|
latest
|
||||||
tore
|
tore
|
||||||
tumor
|
tumor
|
||||||
flow
|
flow
|
||||||
|
@ -15,10 +15,13 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
// Scroll to the bottom of the action history container
|
if (!window.actionHistoryScrollSet) {
|
||||||
const container = document.getElementById('actionHistoryContainer');
|
htmx.onLoad(function(target) {
|
||||||
if (container) {
|
if (target.id === 'actionHistoryContainer') {
|
||||||
container.scrollTop = container.scrollHeight;
|
target.scrollTop = target.scrollHeight;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
window.actionHistoryScrollSet = true;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -26,9 +26,10 @@
|
|||||||
{{if .Room.IsRunning}}
|
{{if .Room.IsRunning}}
|
||||||
<p>Turn of the <span class="text-{{.Room.TeamTurn}}-500">{{.Room.TeamTurn}}</span> team</p>
|
<p>Turn of the <span class="text-{{.Room.TeamTurn}}-500">{{.Room.TeamTurn}}</span> team</p>
|
||||||
{{if .Room.MimeDone}}
|
{{if .Room.MimeDone}}
|
||||||
<p class="text-{{.Room.TeamTurn}}-500">Waiting for guessers</p>
|
<p class="text-{{.Room.TeamTurn}}-500 text-xl">Waiting for guessers</p>
|
||||||
|
<p class="text-{{.Room.TeamTurn}}-500 text-xl">Given Clue: "{{.Room.FetchLastClueWord}}"</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
<p class="text-{{.Room.TeamTurn}}-500">Waiting for mime</p>
|
<p class="text-{{.Room.TeamTurn}}-500 text-xl">Waiting for mime</p>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{template "cardcounter" .Room}}
|
{{template "cardcounter" .Room}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -22,11 +22,10 @@ var (
|
|||||||
SignalChanMap = make(map[string]chan bool)
|
SignalChanMap = make(map[string]chan bool)
|
||||||
DoneChanMap = make(map[string]chan bool)
|
DoneChanMap = make(map[string]chan bool)
|
||||||
// got prompt: control character (\\u0000-\\u001F) found while parsing a string at line 4 column 0
|
// got prompt: control character (\\u0000-\\u001F) found while parsing a string at line 4 column 0
|
||||||
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);
|
|
||||||
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%v`
|
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%v`
|
||||||
MimeSimplePrompt = `we are playing alias;\nyou are to give a clue to your team so they could open these words: %v;\nhere are the words of opposite team you should avoid: %v;\nand here is a black word that is critical not to pick: %s;\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}\nplease return json only.\nunopen Blue cards left: %d;\nunopen Red cards left: %d;`
|
MimeSimplePrompt = `we are playing alias;\nyou are to give a clue and a number of words you mean your team to open; your team words: %v;\nhere are the words of opposite team you want to avoid: %v;\nand here is a black word that is critical not to pick: %s;\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-as-string\",\n\"words_I_mean_my_team_to_open\": [\"this\", \"that\", ...]\n}\nplease return json only.\nunopen Blue cards left: %d;\nunopen Red cards left: %d;`
|
||||||
)
|
)
|
||||||
|
|
||||||
func convertToSliceOfStrings(value any) ([]string, error) {
|
func convertToSliceOfStrings(value any) ([]string, error) {
|
||||||
@ -196,7 +195,12 @@ func (b *Bot) BotMove() {
|
|||||||
mimeResp := MimeResp{}
|
mimeResp := MimeResp{}
|
||||||
b.log.Info("mime resp log", "mimeResp", tempMap)
|
b.log.Info("mime resp log", "mimeResp", tempMap)
|
||||||
mimeResp.Clue = strings.ToLower(tempMap["clue"].(string))
|
mimeResp.Clue = strings.ToLower(tempMap["clue"].(string))
|
||||||
mimeResp.Number = tempMap["number"].(string)
|
var ok bool
|
||||||
|
mimeResp.Number, ok = tempMap["number"].(string)
|
||||||
|
if !ok {
|
||||||
|
b.log.Debug("failed to convert the clue number", "tesp", tempMap, "bot_name", b.BotName)
|
||||||
|
return
|
||||||
|
}
|
||||||
action := models.Action{
|
action := models.Action{
|
||||||
Actor: b.BotName,
|
Actor: b.BotName,
|
||||||
ActorColor: b.Team,
|
ActorColor: b.Team,
|
||||||
@ -404,26 +408,56 @@ func (b *Bot) BuildSimpleGuesserPrompt(room *models.Room) string {
|
|||||||
return fmt.Sprintf(GuesserSimplePrompt, clueAction.Word, words)
|
return fmt.Sprintf(GuesserSimplePrompt, clueAction.Word, words)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Bot) BuildSimpleMimePrompt(room *models.Room) string {
|
||||||
|
ourwords := []string{}
|
||||||
|
theirwords := []string{}
|
||||||
|
blackWord := ""
|
||||||
|
for _, card := range room.Cards {
|
||||||
|
if card.Revealed { // skipped already opened
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
switch card.Color {
|
||||||
|
case models.WordColorBlack:
|
||||||
|
blackWord = card.Word
|
||||||
|
case models.WordColorBlue:
|
||||||
|
if b.Team == models.UserTeamBlue {
|
||||||
|
ourwords = append(ourwords, card.Word)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
theirwords = append(theirwords, card.Word)
|
||||||
|
case models.WordColorRed:
|
||||||
|
if b.Team == models.UserTeamRed {
|
||||||
|
ourwords = append(ourwords, card.Word)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
theirwords = append(theirwords, card.Word)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fmt.Sprintf(MimeSimplePrompt, ourwords, theirwords, blackWord, room.BlueCounter, room.RedCounter)
|
||||||
|
}
|
||||||
|
|
||||||
func (b *Bot) BuildPrompt(room *models.Room) string {
|
func (b *Bot) BuildPrompt(room *models.Room) string {
|
||||||
if b.Role == "" {
|
if b.Role == "" {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
toText := make(map[string]any)
|
// toText := make(map[string]any)
|
||||||
toText["backlog"] = room.ActionHistory
|
// toText["backlog"] = room.ActionHistory
|
||||||
// mime sees all colors;
|
// // mime sees all colors;
|
||||||
// guesser sees only revealed ones
|
// // guesser sees only revealed ones
|
||||||
if b.Role == models.UserRoleMime {
|
// if b.Role == models.UserRoleMime {
|
||||||
toText["cards"] = room.Cards
|
// toText["cards"] = room.Cards
|
||||||
}
|
// }
|
||||||
data, err := json.Marshal(toText)
|
// data, err := json.Marshal(toText)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
b.log.Error("failed to marshal", "error", err)
|
// b.log.Error("failed to marshal", "error", err)
|
||||||
return ""
|
// return ""
|
||||||
}
|
// }
|
||||||
// Escape the JSON string for inclusion in another JSON field
|
// Escape the JSON string for inclusion in another JSON field
|
||||||
escapedData := strings.ReplaceAll(string(data), `"`, `\"`)
|
// escapedData := strings.ReplaceAll(string(data), `"`, `\"`)
|
||||||
if b.Role == models.UserRoleMime {
|
if b.Role == models.UserRoleMime {
|
||||||
return fmt.Sprintf(MimePrompt, b.Team, b.Team, room.BlueCounter, room.RedCounter, escapedData)
|
// return fmt.Sprintf(MimeSimplePrompt, b.Team, b.Team, room.BlueCounter, room.RedCounter, escapedData)
|
||||||
|
// return fmt.Sprintf(MimePrompt, b.Team, b.Team, room.BlueCounter, room.RedCounter, escapedData)
|
||||||
|
return b.BuildSimpleMimePrompt(room)
|
||||||
}
|
}
|
||||||
if b.Role == models.UserRoleGuesser {
|
if b.Role == models.UserRoleGuesser {
|
||||||
// return fmt.Sprintf(GuesserPrompt, b.Team, b.Team, room.BlueCounter, room.RedCounter, escapedData)
|
// return fmt.Sprintf(GuesserPrompt, b.Team, b.Team, room.BlueCounter, room.RedCounter, escapedData)
|
||||||
|
@ -135,6 +135,15 @@ func (r *Room) FetchLastClue() (*Action, error) {
|
|||||||
return nil, errors.New("no clue in history")
|
return nil, errors.New("no clue in history")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Room) FetchLastClueWord() string {
|
||||||
|
for i := len(r.ActionHistory) - 1; i >= 0; i-- {
|
||||||
|
if r.ActionHistory[i].Action == string(ActionTypeClue) {
|
||||||
|
return r.ActionHistory[i].Word
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Room) GetPlayerByName(name string) (role UserRole, team UserTeam, found bool) {
|
func (r *Room) GetPlayerByName(name string) (role UserRole, team UserTeam, found bool) {
|
||||||
if r.RedTeam.Mime == name {
|
if r.RedTeam.Mime == name {
|
||||||
return "mime", "red", true
|
return "mime", "red", true
|
||||||
|
3305
ru_nouns.txt
Normal file
3305
ru_nouns.txt
Normal file
File diff suppressed because it is too large
Load Diff
1
todos.md
1
todos.md
@ -60,3 +60,4 @@
|
|||||||
- when llm guesses the word it is not removed from a pool of words making it keep guessing it;
|
- when llm guesses the word it is not removed from a pool of words making it keep guessing it;
|
||||||
- bot team does not loses their turn after white card (or limit);
|
- bot team does not loses their turn after white card (or limit);
|
||||||
- name check does not work;
|
- name check does not work;
|
||||||
|
- game did not end when all blue cards were open;
|
||||||
|
Reference in New Issue
Block a user