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.
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.
-
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]
tetris_vid.mp4
- Node.js & NPM - Required for running the server and installing dependencies.
- Heroku CLI - Required if deploying to Heroku.
- MongoDB - A MongoDB database is essential for storing game data like player scores and game states.
- Clone repository onto local machine.
git clone CoTetris
-
Navigate to local respository folder.
-
Create a
.env
file in the top directory of your local repository -
Set up your MongoDB connection: Add the following to your
.env
file, replacingusername
,password
,appName
, andyour-database-url
with your MongoDB credentials:
MONGO_URI= 'mongodb+srv://username:password@your-database-url/appName?retryWrites=true&w=majority'
username
: Your MongoDB usernamepassword
: Your MongoDB passwordyour-database-url
: The URL provided by MongoDB when you set up your clusterappName
: Your database name
- Install dependencies:
npm install
- 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.
- 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. - 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:
- 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. - 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.
- Push to Heroku: Deploy your application by pushing the local repository to the Heroku remote:
git push heroku master
-
Ensure the MongoDB URI is set in Heroku: Set your environment variables (s
MONGO_URI
) in Heroku's settings under "Config Vars" to match those in your.env
file. -
Running the Application on Heroku: Navigate to your application's URL provided by Heroku to see your Co-Tetris game live.
Click here to learn how to customize the Co-Tetris game.
Questions? Contact Houston Claure at houston.claure@yale.edu.