Fills the quadrille based on a bitboard pattern passed as a JavaScript BigInt. Each 1 bit in the binary representation corresponds to a filled cell with the given value. The bitboard is read in row-major order, using big-endian by default.

To use little-endian ordering instead, pass true as the third argument.

Example#

(click to toggle the smiley bitboard pattern)

code
Quadrille.cellLength = 50;

let quadrille;
let smileyOn;

const SMILEY = 0b0000000_0110110_0001000_0001000_0100010_0011100_0000000n;

function setup() {
  createCanvas(350, 350);
  quadrille = createQuadrille(7, 7);
}

function draw() {
  background('lemonchiffon');
  drawQuadrille(quadrille);
}

function mousePressed() {
  smileyOn ? quadrille.clear() : quadrille.fill(SMILEY, color('black'));
  smileyOn = !smileyOn;
}

The bitboard must be a BigInt (note the n suffix: 0b0011100n). A plain Number is dispatched as fill(row, value) instead — silently filling a row, not a pattern.

Syntax#

fill(bitboard, value[, littleEndian])

Parameters#

ParamDescription
bitboardBigInt: A bitboard whose binary representation determines the filled cells
valueAny: A valid JavaScript value (e.g. string, number, object, function) to assign to filled cells
littleEndianOptional Boolean: If true, the bitboard is interpreted in little-endian order (default is false)