puzzle

1 – ouvrir un puzzle jigidi
2 – CTRL + Maj + I , puis cliquer sur « console »
3 – Copier le code ci-après et le coller dans la console
4 – Le lancer par la touche entrée
5 – Pour finir, relancer le puzzle avec le bouton « restart »

// generated more contrasting colors using this tool: https://mokole.com/palette.html
// found the light colors hard to distinguish
window.jColors = ['red', 'seagreen', 'gold', 'mediumvioletred', 'lime', 'blue', 'dodgerblue'];
window.lColors = ['white', 'black', 'purple', 'darkgray', '#009'];
window.lWidths = [3, 8, 13];
window.jCols = parseInt(document.getElementById('info-creator').innerText.match(/(\d+)×/)[1]);
window.jC = 0;
CanvasRenderingContext2D.prototype.putImageData = function (imageData, dx, dy) {
const col = window.jC % window.jCols;
const row = Math.floor(window.jC / window.jCols);
this.fillStyle = window.jColors[col % window.jColors.length];
this.fillRect(-1000, -1000, 2000, 2000);
if (0 == (row % 2)) { this.fillStyle = '#ffffff33'; this.fillRect(-1000, -1000, 2000, 2000); }
this.fillStyle = window.lColors[row % window.lColors.length];
// adjust position of vertical line - won't be aligned but still help differentiate columns with the same color
this.fillRect(-1000, 35, 2000, window.lWidths[row % window.lWidths.length]);
this.fillStyle = window.lColors[col % window.lColors.length];
this.fillRect(35, -1000, window.lWidths[col % window.lWidths.length], 2000);
// little smaller font so that the numbers are less likely to be cut of on the edge of the tile
this.font = 'bold 11px sans-serif';

// print the col first since i sort the cols first by color and it makes it more readable
// print it a few times since not sure where the center of the tile is
// print it in black and white for better contrast with darker and lighter colors (and simplicity ;) )
this.fillStyle = 'black';
this.fillText(`${col + 1},${row + 1} -- `.repeat(10), 0, 25);
this.fillText(`${col + 1},${row + 1} -- `.repeat(10), 0, 50);
this.fillText(`${col + 1},${row + 1} -- `.repeat(10), 0, 75);

this.fillStyle = 'white';
this.fillText(`${col + 1},${row + 1} -- `.repeat(10), 0, 38);
this.fillText(`${col + 1},${row + 1} -- `.repeat(10), 0, 63);
this.fillText(`${col + 1},${row + 1} -- `.repeat(10), 0, 88);

window.jC++;
}