An open API service indexing awesome lists of open source software.

https://github.com/b-goodman/minesweeper-game

Minesweeper game implemented with custom elements.
https://github.com/b-goodman/minesweeper-game

custom-elements game web-components

Last synced: about 2 months ago
JSON representation

Minesweeper game implemented with custom elements.

Awesome Lists containing this project

README

          

# minesweeper-game

The popular game 'minesweeper' made available as a custom element.

## Installation

```bash
yarn add @bgoodman/minesweeper-game

npm install @bgoodman/minesweeper-game
```

## Usage

```html

Minesweeper

```

## Attributes

### `width` (number)

The width (in cells) of the game grid.

### `height` (number)

The height (in cells) of the game grid.

### `mines` (number)

Override the default amount of mines placed in the game. Otherwise calculated as `Math.floor(Math.sqrt(height * width))`.

### `scale` (number)

Override the game's default scale in multiples of `1`. Values less(greater) than `1` will result in a smaller(larger) width and height of the game grid. Default scale (`1`) renders each cell in the game grid as `30px` x `30px`.

---

## Methods

### `newGame(): void`

Resets the current game using existing values of `width`, `height` and (optionally) `mines`.