{"id":1888,"date":"2025-12-06T14:11:12","date_gmt":"2025-12-06T14:11:12","guid":{"rendered":"https:\/\/clubvivremieux.com\/?page_id=1888"},"modified":"2025-12-06T14:11:12","modified_gmt":"2025-12-06T14:11:12","slug":"jeu-de-mots-fleches-2","status":"publish","type":"page","link":"https:\/\/clubvivremieux.com\/index.php\/jeu-de-mots-fleches-2\/","title":{"rendered":"Jeu de Mots Fl\u00e9ch\u00e9s (2)"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"fr\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Jeu de Mots Fl\u00e9ch\u00e9s<\/title>\n<style>\n    body { font-family: Arial, sans-serif; display: flex; flex-direction: column; align-items: center; padding: 20px; background-color: #f9f9f9; }\n    h1 { margin-bottom: 10px; color: #333; }\n    .grid { display: grid; gap: 2px; margin-bottom: 20px; }\n    .cell { width: 35px; height: 35px; text-align: center; font-size: 18px; text-transform: uppercase; border: 1px solid #ccc; background-color: #fff; display: flex; align-items: center; justify-content: center; }\n    .cell.correct { background-color: #c8f7c5; border-color: #4caf50; }\n    .cell.wrong { background-color: #f7c5c5; border-color: #f44336; }\n    .cell input { width: 100%; height: 100%; text-align: center; border: none; font-size: 18px; text-transform: uppercase; outline: none; background: transparent; }\n    .definition { margin: 5px 0; font-size: 14px; color: #555; }\n    button { padding: 10px 20px; font-size: 16px; margin-top: 10px; cursor: pointer; border: none; background-color: #4caf50; color: #fff; border-radius: 5px; }\n    button:hover { background-color: #45a049; }\n    .footer { margin-top: 20px; font-size: 14px; color: #555; }\n<\/style>\n<\/head>\n<body>\n<h1>Jeu de Mots Fl\u00e9ch\u00e9s<\/h1>\n<div id=\"game\"><\/div>\n<button onclick=\"checkAnswers()\">V\u00e9rifier les r\u00e9ponses<\/button>\n<button onclick=\"nextLevel()\">Niveau Suivant<\/button>\n<div class=\"footer\">cr\u00e9\u00e9 par Guido SAVERIO<\/div>\n\n<script>\nconst levels = [\n  {\n    size: 5,\n    words: [\n      {word: 'BANANA', x: 0, y: 0, direction: 'horizontal', clue: 'Fruit jaune'},\n      {word: 'DOG', x: 0, y: 0, direction: 'vertical', clue: 'Animal qui aboie'}\n    ]\n  },\n  {\n    size: 7,\n    words: [\n      {word: 'PARIS', x: 0, y: 0, direction: 'horizontal', clue: 'Capitale de la France'},\n      {word: 'BLUE', x: 1, y: 2, direction: 'vertical', clue: 'Couleur du ciel'}\n    ]\n  },\n  {\n    size: 10,\n    words: [\n      {word: 'VIOLON', x: 2, y: 1, direction: 'horizontal', clue: 'Instrument \u00e0 cordes'},\n      {word: 'MARS', x: 0, y: 0, direction: 'vertical', clue: 'Plan\u00e8te rouge'}\n    ]\n  }\n];\n\nlet currentLevel = 0;\n\nfunction createGrid(level) {\n    const gameDiv = document.getElementById('game');\n    gameDiv.innerHTML = '';\n\n    const size = level.size;\n    const grid = document.createElement('div');\n    grid.className = 'grid';\n    grid.style.gridTemplateColumns = `repeat(${size}, 35px)`;\n    grid.style.gridTemplateRows = `repeat(${size}, 35px)`;\n\n    let cells = [];\n    for (let y = 0; y < size; y++) {\n        for (let x = 0; x < size; x++) {\n            const cell = document.createElement('div');\n            cell.className = 'cell';\n            const input = document.createElement('input');\n            input.maxLength = 1;\n            cell.appendChild(input);\n            grid.appendChild(cell);\n            cells.push({element: input, x, y, parent: cell});\n        }\n    }\n\n    level.words.forEach(w => {\n        for (let i = 0; i < w.word.length; i++) {\n            let cell;\n            if (w.direction === 'horizontal') {\n                cell = cells.find(c => c.x === w.x + i && c.y === w.y);\n            } else {\n                cell = cells.find(c => c.x === w.x && c.y === w.y + i);\n            }\n            if (cell) {\n                cell.parent.correct = w.word[i].toUpperCase();\n            }\n        }\n    });\n\n    gameDiv.appendChild(grid);\n\n    level.words.forEach((w, idx) => {\n        const clueDiv = document.createElement('div');\n        clueDiv.className = 'definition';\n        clueDiv.textContent = `${w.direction.toUpperCase()} ${idx+1}: ${w.clue}`;\n        gameDiv.appendChild(clueDiv);\n    });\n}\n\nfunction checkAnswers() {\n    const inputs = document.querySelectorAll('.cell');\n    let allCorrect = true;\n\n    inputs.forEach(cell => {\n        const input = cell.querySelector('input');\n        if (cell.correct) {\n            if (input.value.toUpperCase() === cell.correct) {\n                cell.classList.add('correct');\n                cell.classList.remove('wrong');\n            } else {\n                cell.classList.add('wrong');\n                cell.classList.remove('correct');\n                allCorrect = false;\n            }\n        }\n    });\n\n    if (allCorrect) {\n        alert('Bravo ! Vous avez compl\u00e9t\u00e9 le niveau.');\n    } else {\n        alert('Certaines r\u00e9ponses sont incorrectes. Continuez !');\n    }\n}\n\nfunction nextLevel() {\n    if (currentLevel < levels.length - 1) {\n        currentLevel++;\n        createGrid(levels[currentLevel]);\n    } else {\n        alert('F\u00e9licitations ! Vous avez termin\u00e9 tous les niveaux.');\n    }\n}\n\ncreateGrid(levels[currentLevel]);\n<\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Jeu de Mots Fl\u00e9ch\u00e9s Jeu de Mots Fl\u00e9ch\u00e9s V\u00e9rifier les r\u00e9ponses Niveau Suivant cr\u00e9\u00e9 par Guido SAVERIO<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1888","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/clubvivremieux.com\/index.php\/wp-json\/wp\/v2\/pages\/1888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/clubvivremieux.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/clubvivremieux.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/clubvivremieux.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/clubvivremieux.com\/index.php\/wp-json\/wp\/v2\/comments?post=1888"}],"version-history":[{"count":1,"href":"https:\/\/clubvivremieux.com\/index.php\/wp-json\/wp\/v2\/pages\/1888\/revisions"}],"predecessor-version":[{"id":1889,"href":"https:\/\/clubvivremieux.com\/index.php\/wp-json\/wp\/v2\/pages\/1888\/revisions\/1889"}],"wp:attachment":[{"href":"https:\/\/clubvivremieux.com\/index.php\/wp-json\/wp\/v2\/media?parent=1888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}