Skip to content

Instantly share code, notes, and snippets.

Last active February 3, 2018 13:06
What would you like to do?
An interactive story
state style
body { background: gold; color: red; } a { color: #900; }

You found a treasure!

You can steal the treasure or you can just go back to the forest.

init state style
function() { = + 1 || 1; }
cityCounter citizen
function() { return + ' time' + ( > 1 ? 's' : ''); }
function() { return > 4; }
body, footer { background: #222; color: #eee; }

A big and crowded city.

{{^citizen}} You have visited the city {{cityCounter}}. {{/citizen}}


{{#citizen}} You visited this city so many times... This is your new home now. {{/citizen}} {{^citizen}} Go back. {{/citizen}}

body, footer { background: #44e544; color: #fff; } a { color: #227222; }

You're in the forest.


{{^cave}} Go back or explore the cave. {{/cave}}

{{#cave}} {{#treasure}} You feel guilty because you stole a treasure, but you're rich. You're ready to start a new life in the city. {{/treasure}} {{^treasure}} You have nothing, but yourself and the nature. You're happy. {{/treasure}} {{/cave}}


You take all the gold that you can and run back to the forest.

body, h1, h2, h3, h4 {
font-family: monospace;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment