1.1.2 • Published 3 years ago

@java4life/gridgame v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

GridGame

A TypeScript class that makes it easy to create grid based games.

GridGame is a TypeScript helper class that creates a playing field.
It needs to know the amount of tiles you want horizontally and vertically.
It also supports a function that it can call that will set custom information that the game needs per tile.
For example a click counter or a secret that lies beneath the tile.
For Minesweeper the secret would be the kind of the tile: Is it a bomb or not.

GridGame contains the following helper methods: (see API document)

It lets you create a lot with just a few lines of code:

  • Minesweeper: 45 lines of code
  • Sokoban: 67 lines of code
  • Tic-tac-toe with decision tree AI: 137 lines of code
  • Chess with Toledo Nanochess AI: 70 lines of code
  • Peg-Solitair: 36 lines of code
  • Lightsout: 25 lines of code
  • Tetris: unfinished

Usage:

npm install @java4life/gridgame --save
and then in (TypeScript) code do
import {GridGame} from '@java4life/gridgame';

Here are some demos:

Minesweeper

https://stackblitz.com/edit/typescript-minesweeper

Sokoban

Sokoban

https://stackblitz.com/edit/sokoban
https://stackblitz.com/edit/sokoban-level-editor

Tetris

https://stackblitz.com/edit/typescript-tetris

Tic-tac-toe

https://stackblitz.com/edit/typescript-tictactoe

Chess

https://stackblitz.com/edit/typescript-nanochess

Peg-Solitair

Peg-Solitair

https://stackblitz.com/edit/typescript-peg-solitair

Lightsout

https://stackblitz.com/edit/typescript-lightsout
Play: https://typescript-lightsout.stackblitz.io/

Conway's Game of Life

https://stackblitz.com/edit/conways-game-of-life-using-gridgame

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago