Twitter Werewolf Game

Creative javascript coding

Computational poetry, game UI

Solo coding project

Time: 11/2017


Twitter Werewolf Game is a creative javascript coding project, in which the algorithms will retrieve data from Twitter to generate interactive gothic poems based on a werewolf-themed story context. At the beginning of this game, the player is asked to input 4 Twitter accounts for the program to retrieve data from. Then the program will save the words they find in the tweets and use them to create computational poems. Inspired by the board game Werewolf, a werewolf-haunting story background is also introduced to allow people to interact with the poems.


You can play this game live by clicking here.

In the story, the player was about to visit a village haunted by a werewolf. The four Twitter users the player input were other visitors in this village. But when darkness fell, one of them turned into a werewolf but the player didn't know who it was due to the chaos at night. The second morning, each of the Twitter users left a poem to describe what they saw last night. The player’s goal is to guess which poem was written by the werewolf by comparing the words and sentences they used.


The research question in this project is how to create data-driven poems based on a specific theme or within a storytelling context. Meanwhile, this project also imitates the traditional board game mechanism to explore the possibility of allowing people to interact with the computational literature even if it doesn’t make sense.

User Interface

I designed the user interface and drew all of the illustrations to make the story immersive and visually appealing to players.

Algorithmic Choices

The project is written mainly in javascript. Several libraries including p5.js, p5.dom.js, RiTa.js, codebird.js are used to visually and functionally structure the whole page. DOM elements are heavily used to create a user-friendly and visually aesthetic interface. 


As for how to create poems from Twitter data. Codebird.js helps the program to use Twitter API to retrieve data from Twitter accounts. The project mainly uses "statuses_userTimeline" API to fetch tweets from each user.


RiTa.js is a library used to manipulate the words and obtain their semantic information. First, this library will help the program to get noun words, verb words and adjective words from each user’s tweets. Then the project sets a context-free grammar for the generation of poems. To make sure the contents of the poems would be connected with the werewolf story, several templates were preset and left blanks for the twitter words to be filled in. 


Here are two poem samples generated from different Twitter users: