Enha: simplier guesser prompt
This commit is contained in:
@ -24,6 +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`
|
||||
// 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`
|
||||
GuesserSimplePrompt = `we are playing game of alias;\n you were given a clue: \"%s\";\nnumber of words you can open with that clue is:%s;\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}\nhere is the words that left:\n%s`
|
||||
)
|
||||
|
||||
type DSResp struct {
|
||||
@ -352,6 +353,13 @@ func saveRoom(room *models.Room) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Bot) BuildSimpleGuesserPrompt(room *models.Room) string {
|
||||
clue := room.ActionHistory[len(room.ActionHistory)-1].Word
|
||||
number := room.ActionHistory[len(room.ActionHistory)-1].Number
|
||||
words := make([]string, len(room.Cards))
|
||||
return fmt.Sprintf(GuesserSimplePrompt, clue, number, words)
|
||||
}
|
||||
|
||||
func (b *Bot) BuildPrompt(room *models.Room) string {
|
||||
if b.Role == "" {
|
||||
return ""
|
||||
@ -363,16 +371,16 @@ func (b *Bot) BuildPrompt(room *models.Room) string {
|
||||
if b.Role == models.UserRoleMime {
|
||||
toText["cards"] = room.Cards
|
||||
}
|
||||
if b.Role == models.UserRoleGuesser {
|
||||
copiedCards := make([]models.WordCard, len(room.Cards))
|
||||
copy(copiedCards, room.Cards)
|
||||
for i, card := range copiedCards {
|
||||
if !card.Revealed {
|
||||
copiedCards[i].Color = models.WordColorUknown
|
||||
}
|
||||
}
|
||||
toText["cards"] = copiedCards
|
||||
}
|
||||
// if b.Role == models.UserRoleGuesser {
|
||||
// copiedCards := make([]models.WordCard, len(room.Cards))
|
||||
// copy(copiedCards, room.Cards)
|
||||
// for i, card := range copiedCards {
|
||||
// if !card.Revealed {
|
||||
// copiedCards[i].Color = models.WordColorUknown
|
||||
// }
|
||||
// }
|
||||
// toText["cards"] = copiedCards
|
||||
// }
|
||||
data, err := json.Marshal(toText)
|
||||
if err != nil {
|
||||
b.log.Error("failed to marshal", "error", err)
|
||||
@ -384,7 +392,8 @@ func (b *Bot) BuildPrompt(room *models.Room) string {
|
||||
return fmt.Sprintf(MimePrompt, b.Team, b.Team, room.BlueCounter, room.RedCounter, escapedData)
|
||||
}
|
||||
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)
|
||||
return b.BuildSimpleGuesserPrompt(room)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user