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

orientCellsfunction

The piece turned turns quarter turns and, if asked, mirrored — the shape a player has in hand.

Import it

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

Definition

function orientCells(piece: Piece, turns: number, flipped: boolean): PieceCell[]

Parameters

NameTypeDescription
piecePiece

The queued piece with relative coloured cells.

turnsnumber

The number of clockwise quarter turns.

flippedboolean

Whether to reflect the piece before rotating it.

Returns

PieceCell[]

The piece turned turns quarter turns and, if asked, mirrored — the shape a player has in hand.

Examples

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

console.log(orientCells({cells:[{row:0,col:0,stone:"black"},{row:0,col:1,stone:"white"}]},1,false));
[
  { row: 0, col: 0, stone: 'black' },
  { row: 1, col: 0, stone: 'white' }
]

What it prints (run when this page was built)

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