Skip to content

philschatz/puzzlescript-rust

Repository files navigation

What is this?

It is a PuzzleScript interpreter written in Rust to play games in your terminal!

Try it out!

Gitpod ready-to-code

Screencaps

Here are some screencaps of games being played.

Gravirinth (original)

(click to see the ascii screencast)

video of the beginning of Gravirinth

Mirror Isles (original)

This screencast shows playing the game in a terminal using ASCII and ANSI colors.

mirror-isles

Pot Wash Panic! (original)

(click to see the ascii screencast)

video of install and a couple games

Hack the Net (original)

video of a couple levels of Hack-the-Net

Skipping Stones to Lonely Homes (original)

video of the beginning of Skipping Stones (BIG)

Entanglement (original)

video of the beginning of Entanglement

Install

  1. Install Rust
  2. Clone this repository
  3. Run cargo run --release to get the help message
  4. Run cargo run --release -- ./games/{game}.parsed.json to play a game
    • As you complete levels, it will create a save file in the same directory as the game

Test

  • ./test.bash : runs all the tests
  • cargo test : runs unit tests
  • ./test_solutions.bash : replays real games and verifies the solutions still work

Flamegraph

Flamegraphs are great for finding performance problems. Here's how to generate one:

echo "DDD" | sudo cargo flamegraph ./games/roll-those-sixes.parsed.json -- --level 0 --scripted
echo "S.D.S.D.DWAASAWWW..............q" | sudo cargo flamegraph ./games/entanglement-one.parsed.json -- --level 3 --scripted

TODO

  • Build WebAssembly version and add example of using it in a browser
  • Add a parser so the original script.txt files can be used instead of the *.parsed.json files