createQuadrille(width, height, order, value)

createQuadrille(width, height, order, value)

Creates a quadrille and fills its cells using the specified value, which is randomly repeated throughout the quadrille up to order number of times. The dimensions of the quadrille are determined by width and height.

Example

code
let quadrille;

function setup() {
  createCanvas(6 * Quadrille.cellLength, 4 * Quadrille.cellLength);
  quadrille = createQuadrille(6, 4, 13, 150);
}

function draw() {
  background('orange');
  drawQuadrille(quadrille);
}
ℹ️
To define different values in createQuadrille(width, height, order, value), refer to createQuadrille(jagged_array).

Syntax

createQuadrille(width, height, order, value)

Parameters

ParamDescription
widthNumber: The total number of columns for the quadrille
heightNumber: The total number of rows for the quadrille
orderNumber: The number of non-empty cells to be filled with the value
value1Any: valid JavaScript value, with null representing empty cells

  1. If value is a function, it is evaluated per cell. Use Quadrille.factory(({ row, col }) => new Object(...)) to generate a new object per cell. For display routines, use a plain function like ({ row, col, options }) => { ... }. See options for available parameters. ↩︎