Vim Adventures in Elm

A Vim Adventures spinoff in Elm!

About

This game was created entirely using Elm, a purely functional language used to declaratively create web interfaces. We chose Elm for this prototype to explore its language features, such as immutability, static type checking, type inference, union types, and error handling mechanisms. While similar to Haskell in many ways, unlike Haskell or even PureScript, Elm has no support for user-defined typeclasses.

The game was completed as a part of CPSC 311: Definition of Programming Languages at the University of British Columbia.

Demo

level1

level2

Try it here!

Game Features

Implemented Vim keybindings include:

  • Character navigation (h j, k, l)
  • Line navigation (^, $)
  • Navigation to matching parenthesis (%)
  • Functional operators for the above

The game also includes:

  • Obstructions: Vim navigation commands will not work against maze obstructions.
  • "Stock supply": which limits the number of times the user may use each command (and replenish the supply if the user picks up more)
  • Automatic level progression
  • Sound effects

The game is over if you run out of Vim command "stock" before you reach the finish line!

Installation

To install Elm, follow the instructions on Elm's documentation here. This project uses Elm v0.19.0 and various dependencies, listed here.

To install the dependencies, run elm install.

To build the game locally, run elm reactor in the correct directory, and navigate to Main.elm on your localhost:8000.