Thanks to visit codestin.com
Credit goes to github.com

Skip to content

1j01/snakeshift

Repository files navigation

Snakeshift

A negative space puzzle game inspired by Snake and Shift.

Shapeshift in makeshift ways. Shift snakes into lakes. Snake wakes into shapes.

Skin and fang. Yin and yang. Snakes shelter sneks like sheds, then shed kin like skin.

Play the Game

Play Snakeshift in your browser.

You can also play it in your terminal (requires Go):

git clone https://github.com/1j01/snakeshift.git
cd snakeshift/game/go
go run .

The terminal version only supports keyboard controls, and has bug where the rendering may be jumbled until you resize the terminal window.

Controls

Mouse/Pen/Touch

Action Controls
Move Drag anywhere on the screen. You can move multiple directions in one drag.
Switch Snakes Click/tap on a snake
Undo Undo button in toolbar
Redo Redo button in toolbar
Restart (Undoable) Restart button in toolbar

Gamepad

Action Controls
Move Hold left stick in a direction and press β’Ά, or use D-pad
Switch Snakes Shoulder buttons
Undo β“§
Redo β’·
Restart (Undoable) β“Ž

You may need to press a button on the gamepad before the web page can see it.

NOTE: The level editor does not currently support gamepad controls.

Keyboard

Action Controls
Move Arrow keys, WASD, vi keys (HJKL), or Numpad
Switch Snakes Tab
Undo Z
Redo Y
Restart (Undoable) R
Toggle Editor `

The level editor supports these standard shortcuts:

Action Controls
Save Ctrl+S
Open Ctrl+O
Copy Ctrl+C
Cut Ctrl+X
Paste Ctrl+V
Select All Ctrl+A
Delete Delete

Project Structure

This project uses Vite and TypeScript.

  • /game/ β€” the source code.
  • /game/go/ β€” terminal based reimplementation of the game in Go
  • /game/dist/ β€” the built files, which could be deployed to a static web server.
  • /public/ β€” Files in this folder will be copied to the dist directory when building. These are referenced with absolute paths in CSS, but relative paths in HTML and JS, without the /public prefix in either case.
  • /tests/ β€” Playwright tests.
  • /tsconfig.json β€” Typescript settings.
  • /eslintrc.cjs β€” ESLint settings.
  • /vite.config.js β€” Vite settings.
  • /package.json β€” dependencies and scripts.
    • /package-lock.json β€” generated file, used for reproducible builds.
  • /cspell.json β€” spell check settings and dictionary.

Development

Install dependencies and run the dev server:

npm install
npm run dev

There is also an experimental level generator and terminal version written in Go, which can be run with:

cd game/go
go run . --generate >../../game/public/levels/tests/generated-level.json
go run .

Quality Control

This command runs the spell checker, the typescript compiler, and eslint:

npm run lint

This command will run tests using Playwright:

npm run test

Learn more about Playwright's philosophy and tooling.
It has great VS Code integration, a test recorder/generator, a trace viewer including screen capture replay, and more.

File Format Versioning

When the file format changes, increment FORMAT_VERSION and add an upgrade step for backwards compatibility in game-state.ts.

To update all levels to the new format, run:

npm run update-level-format

Deployment

To build for production and push to GitHub Pages:

npm run deploy

Ideas and TODOs

See TODO.md.

License

This project is licensed under the MIT License. See the LICENSE.txt file for details.

About

Inverse space snake puzzle game β˜―οΈŽπ“†“βœ§βœ¦οΈŽπ“†š

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published