swap(row1, col1, row2, col2)
Swaps the contents of the cell at (row1, col1) with the cell at (row2, col2) in the quadrille.
Example
(click to select cells, press s to swap, or r to randomize)
Syntax
swap(row1, col1, row2, col2)
Parameters
| Param | Description |
|---|---|
row1 |
Number: Row index of the first cell |
col1 |
Number: Column index of the first cell |
row2 |
Number: Row index of the second cell |
col2 |
Number: Column index of the second cell |
What this page's examples use
- p5.quadrille
drawQuadrillecreateQuadrillemouseRowmouseColrandomizeisValidswap- p5.js
createCanvasbackgroundloadImagekey- JavaScript
Array.push
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.