This is a program that allows people to play PuzzleScript games in a browser or in a terminal.
Also, it is accessible, meaning that blind or visually impaired people can play these games too! See blog post for more info or try the demo.
npm install -g puzzlescript
to installpuzzlescript
to start playingSee ./test/browser/html-table.xhtml for an example of embedding in a browser.
// Include <script src="node_modules/puzzlescript/dist/puzzlescript.js"></script>
// and then the following:
table = document.querySelector('table') // selector to the <table> that will be used
engine = new PuzzleScript.HTMLTableEngine(table)
engine.setGame(gameSourceString, 0 /*startLevel*/)
engine.start()
Here are some screencaps of games being played.
This screencast shows playing the game in a terminal using ASCII and ANSI colors.
(click to see the ascii screencast)
PuzzleScript lends itself nicely to be playable by people with low or no vision:
If you are blind, you can play the games by running puzzlescript --no-ui
and use the I, K, J, L, and P keys to move the cursor to explore the level.
If you want to experience what a non-sighted person would experience but still see the level, run NODE_ENV=development puzzlescript
and use the I, K, J, L, and P keys to move the cursor to explore the level.
This screencap is a visual demonstration of exploring and then playing a level.
This screencap is the non-visual version of the same steps as shown above. This is what vision-impaired people will read when they move the Inspector cursor around and then move the player to play the game.
The goal of this project is to do 3 things:
--no-ui
argument)To use https://chromevox.com, table navigation keys on the Mac are Ctrl + Command + Up.
This is a remake of PuzzleScript that has the following features:
To convert a game to JSON, run the following:
import { Parser } from 'puzzlescript'
import Serializer from 'puzzlescript/lib/parser/serializer'
const { data } = Parser.parse(gameSource)
const json = new Serializer(data).toJson()
const reparsedData = Serializer.fromJson(json, gameSource)
npm run docs
generates docs in the ./docs/
directorynpm start
runs a game in the ./gists/ directory without debugging info (10x faster) (uses NODE_ENV=production
)npm run start:dev
runs a game in the ./gists/ directory with sprite info (useful for debugging)npm run start:debug
runs a game in the ./gists/ directory with a Chrome Debugger open so you can set breakpointsnpm demo
runs all of the games in the ./gists/ directory with a few sample moves (up/down/left/right/action)npm test
runs all of the unit tests (including solutions in the ./gist-solutions/ directory)npm run watch
Run the tests and when you update the source, it re-runs the testsnpm run test:debug
Run the tests but opens a debugger (remember to add a debugger
line into the JavaScript)npm test; open coverage/lcov-report/index.html
to see test coveragenpm run coverage
generates a coverage report which includes the JS code as well as any games that you ran in dev mode (using npm run dev
)npm run build:stats
and then uploading webpack-stats.json
to https://webpack.github.io/analyse/#modulesWant to help? Here is a roadmap of things that need to be implemented:
RIGID
keywordBEL
(ASCII character 7) when the speaker
package is not installedCREATE
, DESTROY
, CANTMOVE
RESTART
, UNDO
, TITLESCREEN
, STARTGAME
, STARTLEVEL
, ENDLEVEL
, ENDGAME
, SHOWMESSAGE
, CLOSEMESSAGE
SimpleNeighbor.matchesCell()
function so we do not have to recompute if a cell matches a NeighborSimpleNeighbor
that have a direction but none of the tiles depend on the direction (causes fewer caches to be updated)getMatches(level)
by storing a cache of all the sprites in each row/column so we can skip the row/column entirely if the necessary sprites are not availableGenerated using TypeDoc