Dark Forest Program
I wanted to get into a new programming language in 2019, and play with words with my 5-year-old. So I built a program that interprets a folder of text files as a semi-interactive story on the command line, in Rust.
The program "types" out the story as if someone were controlling the terminal, one letter at a time, with some jitter and pauses somewhat mimicking a person.
The program interprets any text within brackets (
) to be macro commands.
|time||Insert a pause, by seconds||
|color||Change the enclosed text's color||
|title||Output a title||
|input||Take a reader's input and save it to a variable for
|input=path()||A path input forks to a new text file in the story||
Here is how a story could start:
[input=your_name|Enter your name:]
...You enter a dark forest...
You once asked me to share my wisdom with you.
So I will.
A fork in the road lies before you.
You may walk through the [color=green|mirror], or learn to [color=green|bike].
[input=path(mirror,bike)|Which fork will you take?]
And this is about how it turns out: