Skip to content

A research platform for investigating multi party interactions with AI systems.

License

Notifications You must be signed in to change notification settings

hbclaure/Co_Tetris

Repository files navigation

Co-Tetris 🎮

tetrisGIF

Co-Tetris is a research platform designed to study cooperative and competitive strategies in multiplayer scenarios, using the classic Tetris game as a framework for analyzing interactions between humans and AI agents. Click on the GIF to watch a video of Co-Tetris.

Introduction

The objective of the Co-Tetris is for multiple players to collaborate (or compete) to obtain the highest possible score. A third preprogrammed player is charged with decididng who gets access to the falling Tetris block. This repository enables you to run your own version of the game, either locally or online. Co-Tetris has been utilized for deploying reinforcement learning algorithms and studying how humans respond to AI-driven allocation decisions.

A live version of the game can be found here. Note that gameplay requires two people to log in simultaneously:

https://cotetris2.herokuapp.com/

Co-Tetris was developed and supported by Houston Claure, Seyun Kim, Winnice Hui, Obinna Abbi, Hyun Kyo Jung, and Malte Jung from Cornell University, Connor Brown from Yale University, and Jignesh Modi and Stefanos Nicholaidis from the University of Southern California.

Research Papers Using Co-Tetris

  • Claure, H., Kim, S., Kizilcec, R. F., & Jung, M. (2023). The social consequences of machine allocation behavior: Fairness, interpersonal perceptions and performance. Computers in Human Behavior. [Paper]

  • Claure, H., Chen, Y., Modi, J., Jung, M., & Nikolaidis, S. (2020). Multi-armed bandits with fairness constraints for distributing resources to human teammates. In Proceedings of the 2020 ACM/IEEE International Conference on Human-Robot Interaction. [Paper] [Code]

Co-Tetris Demonstration

tetris_vid.mp4

Running the Game on Your Local Computer

Requirements

  1. Node.js & NPM - Required for running the server and installing dependencies.
  2. Heroku CLI - Required if deploying to Heroku.
  3. MongoDB - A MongoDB database is essential for storing game data like player scores and game states.

Installation

  1. Clone repository onto local machine.
git clone CoTetris
  1. Navigate to local respository folder.

  2. Create a .env file in the top directory of your local repository

  3. Set up your MongoDB connection: Add the following to your .env file, replacing username, password, appName, and your-database-url with your MongoDB credentials:

MONGO_URI= 'mongodb+srv://username:password@your-database-url/appName?retryWrites=true&w=majority'
  • username: Your MongoDB username
  • password: Your MongoDB password
  • your-database-url: The URL provided by MongoDB when you set up your cluster
  • appName: Your database name
  1. Install dependencies:
npm install

Running Locally

  1. Run Co-Tetris on your local computer:
npm run dev

Navigate to localhost:3000 in your web browser to see the application running locally. You will need to log in on at least two tabs to connect to the game.

Deploying the Game Online

1. Follow the installation steps for running the game on your local computer.

Heroku Deployment

  1. Log in to your Heroku account via CLI: Run heroku login to open the login prompt in your browser. Log in using your Heroku credentials or create a new account if necessary.
  2. Set up Heroku remote: After logging in and creating a new Heroku app in your dashboard (if you haven't already), set the remote for your app using:

Heroku Deployment

  1. Log in to your Heroku account via CLI: Run heroku login to open the login prompt in your browser. Log in using your Heroku credentials or create a new account if necessary.
  2. Set up Heroku remote: After logging in and creating a new Heroku app in your dashboard (if you haven't already), set the remote for your app using:
heroku git:remote -a your-heroku-app-name

Replace your-heroku-app-name with the name of your app on Heroku.

  1. Push to Heroku: Deploy your application by pushing the local repository to the Heroku remote:
git push heroku master
  1. Ensure the MongoDB URI is set in Heroku: Set your environment variables (sMONGO_URI) in Heroku's settings under "Config Vars" to match those in your .env file.

  2. Running the Application on Heroku: Navigate to your application's URL provided by Heroku to see your Co-Tetris game live.

Customizing Gameplay

Click here to learn how to customize the Co-Tetris game.

Contact

Questions? Contact Houston Claure at houston.claure@yale.edu.