webbiscuit / haskell-adventure

Haskell your own adventure! Parse, play and analyse gamebooks from text files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Haskell Your Own Adventure

Build Status

What is it?

A functional project that can parse, play and analyse gamebooks from text.

This early version parses basic text files into section and choice objects and can output in a few different ways.

Pre-reqs

Stack

stack setup
stack install hlint

Building

stack build

Debugging

stack ghci
parseTextIntoBook "1\nAll of these passages look alike. Turn to 1"

Running tests

stack test

To watch files and continuously run tests:

stack test --file-watch --fast

Linting

hlint src

Documentation

stack haddock --no-haddock-deps

Usage

stack run -- --file app/books/fridge.txt

or

stack run -- --stdin < app/books/fridge.txt

or (when built)

haskelladventure.exe --stdin < path-to-your-gamebook

Outputs

There are a few formats currently supported:

debug (haskell debugging)
json (parsed as json objects)
dot (graphviz dot format)

stack run -- --output json --file app/books/fridge.txt

png, pdf, etc

Right now the simplest way is to install Graphviz, export to dot format and use the many outputs via the dot cli. Example:

stack run -- --output dot --file app/books/fridge.txt | dot -T png > out.png

Where T (type) can be any of these formats.

Sample Books

Fridge

A horror scenario where you wake up trapped inside a fridge.

About

Haskell your own adventure! Parse, play and analyse gamebooks from text files.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 100.0%