Quadrille.chessKeys

The reverse of Quadrille.chessSymbols: a new Map from the drawn value back to its FEN letter, so a cell can be asked what piece it holds without knowing the skin. Rebuilt on every read, from the current map — a custom symbol appears here as soon as it is assigned.

Example

edit, then run

Note

Click the sketch to see the reverse map follow the forward one: 👸 appears where ♛ was, because the getter rebuilds from the current symbols. A cell drawn with a custom symbol is read back with Quadrille.chessKeys.get(value).

What this page's examples use
p5.quadrille
chessSymbols chessKeys
p5.js
createCanvas background text key fill textFont textSize noLoop redraw

Names the analysis can prove are called, and the line each one is documented on. Local variables and members of an unknown receiver are left out.