Skip to the content

Narabe並べ

Play forty-eight abstract board games through immutable moves, legal choices and replayable records.

Narabe means arranging in Japanese, as in gomoku-narabe: five in a row. About the name

Contents

Reference · Rules and records

lineDirectionsForfunction

The directions a winning line may run: the hexagon's three axes on a hexagon board, the square's four otherwise.

Import it

import { lineDirectionsFor } from "@johnmorrisdotca/narabe";

Definition

function lineDirectionsFor(hexagon: boolean): readonly Point[]

Parameters

NameTypeDescription
hexagonboolean

Whether to use the hexagonal rather than square line directions.

Returns

readonly Point[]

The directions a winning line may run: the hexagon's three axes on a hexagon board, the square's four otherwise.

Examples

import { lineDirectionsFor } from "@johnmorrisdotca/narabe";

console.log(lineDirectionsFor(false));
[
  { row: 0, col: 1 },
  { row: 1, col: 0 },
  { row: 1, col: 1 },
  { row: 1, col: -1 }
]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/narabe 1.3.0.