1.1.2 • Published 3 years ago

minesweeper-board v1.1.2

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

Minesweeper-board

A fast, lightweight Node module for generating minesweeper boards.

install size weekly downloads

Installation:

npm i minesweeper-board

# or

yarn add minesweeper-board

Usage:

//cjs:
const { Board } = require('minesweeper-board');

//mjs:
import { Board } from 'minesweeper-board';

const board = new Board(5, 5); //dimension, mines
console.log(board.getBoard());

example 5x5 board:

$ node dist/tests/test
[
  [
    Cell { hasMine: false, id: 'A0' },
    Cell { hasMine: false, id: 'A1' },
    Cell { hasMine: false, id: 'A2' },
    Cell { hasMine: true, id: 'A3' },
    Cell { hasMine: true, id: 'A4' }
  ],
  [
    Cell { hasMine: false, id: 'B0' },
    Cell { hasMine: false, id: 'B1' },
    Cell { hasMine: false, id: 'B2' },
    Cell { hasMine: false, id: 'B3' },
    Cell { hasMine: false, id: 'B4' }
  ],
  [
    Cell { hasMine: false, id: 'C0' },
    Cell { hasMine: false, id: 'C1' },
    Cell { hasMine: true, id: 'C2' },
    Cell { hasMine: false, id: 'C3' },
    Cell { hasMine: false, id: 'C4' }
  ],
  [
    Cell { hasMine: false, id: 'D0' },
    Cell { hasMine: false, id: 'D1' },
    Cell { hasMine: false, id: 'D2' },
    Cell { hasMine: true, id: 'D3' },
    Cell { hasMine: true, id: 'D4' }
  ],
  [
    Cell { hasMine: false, id: 'E0' },
    Cell { hasMine: false, id: 'E1' },
    Cell { hasMine: false, id: 'E2' },
    Cell { hasMine: false, id: 'E3' },
    Cell { hasMine: false, id: 'E4' }
  ]
]
  • hasMine: indicates if the cell has a mine or not.
  • id: a string that can be used to identify a cell.
1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago