Skip to content

A solo mode for Codenames (the boardgame) using streamlit and the OpenAI API

Notifications You must be signed in to change notification settings

ameroyer/codenames_solo

Repository files navigation

Codenames Solo Practice

A quick exercise on building streamlit apps and prompting the OpenAI API. For those times when you just want to play a quick Codenames game but have no one to play with :(
Deployed via streamlit at codenames-solo.streamlit.app/

Quickstart

  • Install requirements: pip install openai streamlit
    • Last tested with openai==1.9.0 and streamlit==1.31.1
  • Setup an OpenAI API key if you don't have one already
  • Launch the game
    • streamlit run Game.py

ReadMe

Gameplay

The app will first lead you through some basic configuration (API key, model choice and language for the game's words). After this, the game will start: You play as the spy(ies), while the API queries emulate both spymasters. If you need a refresher, you can find the official rules of Codenames here.

Settings

Do you find the model to be a bad spymaster (it does tend to be a bit repetitive) ? Do you love prompt engineering ? Well you can improve/customize how the API is queried from the options on Settings page. Specifically, you can edit:

  • The base system instruction; useful to customize the high-level spymaster behavior, e.g. its language.
  • The prompt used to query for a hint. The prompt should inclde the special keywords {SLF}, {OPP}, {NTR} and {KLL}, acting as placeholder for the spymaster's cards, opponent team's cards, bystander cards, and assasin card respectively
  • The sampling temperature for generating hints
  • The words list from which the cards on the board are drawn. You can load the default language list for several languages

Some extension Ideas

  • Reverse role (play as the spymaster)
  • Engineer prompts for finer control on the spymaster's play style
  • Codenames Pictures ?

Credits

About

A solo mode for Codenames (the boardgame) using streamlit and the OpenAI API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages