Git Product home page Git Product logo

mafiagpt's Introduction

MafiaGPT

a program that moderate a Mafia(Werewolf) game with 7 players between GPT models.

to see communication, team work and social/logical abilities of GPT model.(it is fun and educational)

the roles are :

  • 1 Medical
  • 1 Seer
  • 3 Villagers
  • 2 Werewolves

Get started

install openai via pip :

pip install openai

set your Openai API key as an enivronmental variable with key : OPENAI_API_KEY

  • you can configure your model(Default is 'gpt-3.5-turbo') and your rate_limit and token_limit in api.py

  • make DEBUG=True in api.py if you want to see all messages passed to GPT model.

python run.py

it will save a log file in the bellow format in records/ folder.

log.json format

every event in the game is a dictionary.

{
  'event':"<event_name>",
  'content':"<...>"
}

events are :

  • roles :
'content':{
  'player':"<player_number>"
  'role':"<role_string>"
}
  • cycle :
'content':"<day/night>"
  • speech :
'content':{
  'player':"<player_number>"
  'context':"<speech_string>"
}
  • voted :
'content':{
  'player':"<player_number>"
  'voted_to_player':"<player_number>"
  'reason':"<complete response>"
}
  • vote_start :
'content':{
  'player':"<player_number>"
  'voted_to_player':"<player_number>"
  'reason':"<complete response>"
}
  • healed :
'content':{
  'player':"<player_number>"
  'reason':"<complete response>"
}
  • targeted :
'content':{
  'player':"<player_number>"
  'reason':"<complete response>"
}
  • killed :
'content':{
  'player':"<player_number>"
}
  • inquiried :
'content':{
  'player':"<player_number>"
  'context':"<True: if player is werewolf>"
  'reason':"<complete response>"
}
  • notetaking :
'content':{
  'player':"<player_number>"
  'context':"<speech_string>"
}
  • end :
'content':{
  'winner':"<Werewolves/Villagers>"
}

Prompts

  • Game Introduction('/intro_prompt.txt') : rules and the role of the player
  • Game Reports('/report_prompt.txt) :
    • Speeches in last round
    • Game status : alive players in seperation of the teams.
    • Players status : alivness of players based on their number
    • Agent previous SPEACIAL actions
    • Agent previous VOTES
    • Notes that have taken by the agent
  • Commands('/game.py') :
    • Speak command
    • Vote command
    • targetting/healing/killing/inquiring command

Tasks

  • optimizing prompts
  • a web interface to play natively a log-file as an animation
  • allowing a player/players to play with GPT (Probably tricky prompts will lead to game hacking.)
  • allowing more chat models or different GPT tempretures to compete

mafiagpt's People

Contributors

megooneh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mafiagpt's Issues

Creating a web interface

Making people able to provide API key and play themselves with other GPT players just via browser.(With PyScript or something ?)

also making it more fantasy with animations or maybe making it interactive...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.