[ { "search": "var puzzlePieces = [];\r\n\r\n // Function to create a puzzle piece\r\n function createPuzzlePiece(id) {\r\n var piece = document.createElement(\"div\");\r\n piece.className = \"puzzle-piece\";\r\n piece.id = \"piece-\" + id;\r\n piece.innerHTML = \"\";\r\n return piece;\r\n }\r\n \r\n // Function to shuffle the puzzle pieces\r\n function shufflePuzzlePieces() {\r\n var container = document.getElementById(\"puzzle-container\");\r\n for (var i = container.children.length; i >= 0; i--) {\r\n container.appendChild(container.children[Math.random() * i | 0]);\r\n }\r\n }\r\n \r\n // Create puzzle pieces\r\n for (var i = 1; i <= 50; i++) {\r\n var piece = createPuzzlePiece(i);\r\n puzzlePieces.push(piece);\r\n }\r\n \r\n // Add puzzle pieces to the container\r\n var container = document.getElementById(\"puzzle-container\");\r\n puzzlePieces.forEach(function(piece) {\r\n container.appendChild(piece);\r\n });\r\n \r\n // Shuffle the puzzle pieces\r\n shufflePuzzlePieces();", "replace": "var puzzlePieces = [];\r\n\r\n // Function to create a puzzle piece\r\n function createPuzzlePiece(id) {\r\n var piece = document.createElement(\"div\");\r\n piece.className = \"puzzle-piece\";\r\n piece.id = \"piece-\" + id;\r\n piece.innerHTML = \"\";\r\n return piece;\r\n }\r\n \r\n // Function to shuffle the puzzle pieces\r\n function shufflePuzzlePieces() {\r\n var container = document.getElementById(\"puzzle-container\");\r\n for (var i = container.children.length; i >= 0; i--) {\r\n container.appendChild(container.children[Math.random() * i | 0]);\r\n }\r\n }\r\n \r\n // Create puzzle pieces\r\n for (var i = 1; i <= 20; i++) {\r\n var piece = createPuzzlePiece(i);\r\n puzzlePieces.push(piece);\r\n }\r\n \r\n // Add puzzle pieces to the container\r\n var container = document.getElementById(\"puzzle-container\");\r\n puzzlePieces.forEach(function(piece) {\r\n container.appendChild(piece);\r\n });\r\n \r\n // Shuffle the puzzle pieces\r\n shufflePuzzlePieces();" } ]