Skip to content

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

License

Notifications You must be signed in to change notification settings

rhulha/GridGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/gridgame-minesweeper

Sokoban

Sokoban

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

Tetris

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

Tic-tac-toe

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

Chess

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

Peg-Solitair

Peg-Solitair

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

Lightsout

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

Conway's Game of Life

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published