Changed around line 1
+ function showExample(trickId) {
+ const exampleBoard = document.getElementById('example-board');
+ const exampleDescription = document.getElementById('example-description');
+ exampleBoard.innerHTML = '';
+ let description = '';
+
+ switch (trickId) {
+ case 'single-candidate':
+ description = 'This example shows how to identify cells with only one possible number.';
+ // Example grid for single candidate
+ for (let i = 0; i < 81; i++) {
+ const cell = document.createElement('div');
+ if (i === 40) {
+ cell.textContent = '5';
+ cell.style.backgroundColor = '#d4edda';
+ }
+ exampleBoard.appendChild(cell);
+ }
+ break;
+ case 'naked-pair':
+ description = 'This example demonstrates how to find and use naked pairs to eliminate possibilities.';
+ // Example grid for naked pair
+ for (let i = 0; i < 81; i++) {
+ const cell = document.createElement('div');
+ if (i === 10 || i === 11) {
+ cell.textContent = '2 3';
+ cell.style.backgroundColor = '#d4edda';
+ }
+ exampleBoard.appendChild(cell);
+ }
+ break;
+ case 'hidden-single':
+ description = 'This example illustrates how to find hidden singles in rows, columns, or boxes.';
+ // Example grid for hidden single
+ for (let i = 0; i < 81; i++) {
+ const cell = document.createElement('div');
+ if (i === 60) {
+ cell.textContent = '7';
+ cell.style.backgroundColor = '#d4edda';
+ }
+ exampleBoard.appendChild(cell);
+ }
+ break;
+ }
+
+ exampleDescription.textContent = description;
+ }