Skip to the content

Jirai地雷

Deal seeded minefields, prove hints from visible clues and mount square, orthogonal, hexagonal or wraparound boards.

Jirai is the Japanese word 地雷 for a land mine. About the name

Contents

Reference · Rules, generation and deductions

GRID_SPECSconstant

Neighbour offsets and edge behaviour for each topology. Hex coordinates are axial: each row is displaced half a cell to the right.

Import it

import { GRID_SPECS } from "@johnmorrisdotca/jirai";

Definition

const GRID_SPECS: Record<Grid, { offsets: readonly (readonly [number, number])[]; wrap: boolean; }> = {
    square: { offsets: [[-1, -1], [0, -1], [1, -1], [-1, 0], [1, 0], [-1, 1], [0, 1], [1, 1]], wrap: false },
    orthogonal: { offsets: [[0, -1], [-1, 0], [1, 0], [0, 1]], wrap: false },
    hex: { offsets: [[-1, 0], [1, 0], [0, -1], [1, -1], [-1, 1], [0, 1]], wrap: false },
    wrap: { offsets: [[-1, -1], [0, -1], [1, -1], [-1, 0], [1, 0], [-1, 1], [0, 1], [1, 1]], wrap: true },
}

Members

NameTypeDescription
orthogonal{ offsets: readonly (readonly [number, number])[]; wrap: boolean; }
square{ offsets: readonly (readonly [number, number])[]; wrap: boolean; }
hex{ offsets: readonly (readonly [number, number])[]; wrap: boolean; }
wrap{ offsets: readonly (readonly [number, number])[]; wrap: boolean; }

Examples

import { GRID_SPECS } from "@johnmorrisdotca/jirai";

console.log(GRID_SPECS);
{
  square: {
    offsets: [
      [Array], [Array],
      [Array], [Array],
      [Array], [Array],
      [Array], [Array]
    ],
    wrap: false
  },
  orthogonal: { offsets: [ [Array], [Array], [Array], [Array] ], wrap: false },
  hex: {
    offsets: [ [Array], [Array], [Array], [Array], [Array], [Array] ],
    wrap: false
  },
  wrap: {
    offsets: [
      [Array], [Array],
      [Array], [Array],
      [Array], [Array],
      [Array], [Array]
    ],
    wrap: true
  }
}

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/jirai 0.5.0.