Skip to content
Go to file


Failed to load latest commit information.
Latest commit message
Commit time

Project logo

Build Status

Word Reactor is a Markov chain-based word generator running inside a physics simulation. Run it in your browser.

Demonstrates the Markov Namegen name generator and Haxe library.


Open it in the browser and generate words. Click or tap empty spaces to spawn stream of words for different topics. Drag the balls around to mix things up, and collide the balls with "topic" words in them to create new words:



Get Markov Namegen on GitHub or through haxelib, and read the documentation here.

Include it in your .hxml

-lib markov-namegen

Or add it to your Project.xml:

<haxelib name="markov-namegen" />

How It Works

The markov-namegen haxelib uses Markov chains to generate random words. Given a set of words as training data, the library calculates the conditional probability of a letter coming up after a sequence of letters chosen so far. It looks back up to "n" characters, where "n" is the order of the model.

The physics simulation is made using Nape, a 2D rigid body physics engine for Haxe. When balls containing topic words collide, balls are added to the simulation that contain new words generated using the training data for those topics.

The visualization is rendered using HTML5 with text, images and canvas elements, using absolute positioning for the balls. This is all kept in sync with the Nape physics simulation in a requestAnimationFrame loop.



The demo code is licensed under CC BY-NC. The haxelib library itself is MIT licensed. Training data was compiled from sites like Wikipedia and census data sources.

You can’t perform that action at this time.