Changed around line 1
+ document.getElementById('createMaze').addEventListener('click', function() {
+ const age = document.getElementById('age').value;
+ const mazeContainer = document.getElementById('mazeContainer');
+ mazeContainer.innerHTML = '';
+
+ const mazeSize = Math.min(Math.max(age - 4, 3), 8); // Adjust maze size based on age
+ const gridSize = mazeSize * mazeSize;
+
+ mazeContainer.style.gridTemplateColumns = `repeat(${mazeSize}, 1fr)`;
+
+ for (let i = 0; i < gridSize; i++) {
+ const cell = document.createElement('div');
+ cell.className = 'maze-cell';
+
+ // Generate simple math problems based on age
+ const num1 = Math.floor(Math.random() * age) + 1;
+ const num2 = Math.floor(Math.random() * age) + 1;
+ const operator = ['+', '-'][Math.floor(Math.random() * 2)];
+ const problem = `${num1}${operator}${num2}`;
+
+ cell.textContent = problem;
+ mazeContainer.appendChild(cell);
+ }
+ });