RepoAI21 LabsAI21 Labspublished Aug 4, 2021seen 5d

AI21Labs/jurades

JavaScript

Open original ↗

Captured source

source ↗
published Aug 4, 2021seen 5dcaptured 8hhttp 200method plain

AI21Labs/jurades

Description: AI Charades game

Language: JavaScript

License: Apache-2.0

Stars: 3

Forks: 2

Open issues: 0

Created: 2021-08-04T18:16:41Z

Pushed: 2021-08-11T13:12:24Z

Default branch: master

Fork: no

Archived: yes

README:

An AI Charades game, _powered by Jurassic-1 language model by AI21Labs Studio_

  • [Running the game](#running-the-game)
  • [Server](#server)
  • [Client](#client)
  • [How to play](#how-to-play)
  • [Configuration](#configuration)

Running the game

The game consist of:

  • A server app, which produces the guesses by sending requests to AI21 Studio. This is done from the backend in order to keep the AI21 Studio API key secured.
  • A client web app which is the actual game, sending request to the server mentioned above.

Server

You need to have python > 3.5 and pip to install the dependencies and run the server.

In order to run the server locally:

1. Enter the server folder and install the python dependencies using pip

cd server
pip install -r requirements.txt

2. Set your AI21 Studio API key as an environment variable. _(Replace with the key you generated in AI21 Studio)_

export AI21_API_KEY=

3. Start Flask's development server

python main.py

*🎉 The server should be up and running locally on port 5000.*

Client

You need to have node and npm installed for running and building the client app.

First of all, make sure to enter the client app's folder:

# Return to the repo's parent folder if you were inside the server folder
cd ..
# Enter the client app folder
cd client

Install the relevant packages

npm i

Running the local dev version

Simply run the following inside the client folder

npm start

And the app will be accessible at http://localhost:3000

Building for production

Run

npm run build

A production bundle will be ready in client/build folder.

How to play?

Start by entering up to 4 players in the welcome screen.

Now, you will all take turns for 3 rounds.

On each turn, the player has 45 seconds to describe as many characters as possible to the computer.

The player may write/say anything they want, except for what's written on the card.

  • If Jurassic guessed correctly, the player gets a point and moves to the next card.
  • If not, they may keep trying and add information so Jurassic will get it right. _Don't worry - it remembers what you've said before and what guesses were wrong!_
  • At any time the player may skip a card if they don't know the character or fail to describe it to Jurassic.

After 3 rounds, the winner is the one with the highest score! _(big surprise)_

Configuration

You can switch between using the large and jumbo model inside server/main.py:

# options are j1-jumbo and j1-large
MODEL = "j1-jumbo"

Also, You can change a few of the game's configuration located in the client's config file.

// client/src/const/game.js
export const ROUND_DUR = 45;
export const NUMBER_OF_ROUNDS = 3;
export const SAMPLE_FACTOR = 4;

export const USE_SPEECH = false;

export const SERVER_URL = "http://localhost:5000/";
  • ROUND_DUR Each turn's duration in seconds
  • NUMBER_OF_ROUNDS The number of rounds in a single game
  • SAMPLE FACTOR Controls the amount of cards being sampled from the full characters list each turn (ROUND_DUR * SAMPLE_FACTOR)
  • USE_SPEECH If true, the player's input is done using speech-to-text instaed of typing.
  • SERVER_URL The backend service URL

The full list with all the possible characters can be found at client/src/assets/figure_list.json.

Excerpt shown — open the source for the full document.