{"id":145,"date":"2025-09-12T23:07:16","date_gmt":"2025-09-12T23:07:16","guid":{"rendered":"https:\/\/trezor.quest\/?page_id=145"},"modified":"2025-11-03T01:28:11","modified_gmt":"2025-11-03T01:28:11","slug":"home","status":"publish","type":"page","link":"https:\/\/trezor.quest\/","title":{"rendered":"Home"},"content":{"rendered":"\n\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, viewport-fit=cover\">\n    <meta name=\"color-scheme\" content=\"dark\">\n    <title>Peg Solitaire<\/title>\n    <style>\n        * {\n            margin: 0;\n            padding: 0;\n            box-sizing: border-box;\n        }\n\n        html, body {\n            width: 100%;\n            height: 100%;\n            overflow-x: hidden;\n            margin: 0;\n            padding: 0;\n            max-width: 100vw;\n        }\n\n        html {\n            height: -webkit-fill-available;\n        }\n\n        body {\n            font-family: 'Courier New', monospace;\n            background: #000 !important;\n            color: #3498DB;\n            position: relative;\n            min-height: 100vh;\n            min-height: -webkit-fill-available;\n            overflow-x: hidden;\n        }\n\n        #countdown-cover {\n            position: fixed;\n            top: 0;\n            left: 0;\n            right: 0;\n            bottom: 0;\n            width: 100%;\n            height: 100%;\n            background: #FFEB3B;\n            z-index: 10000;\n            display: flex;\n            flex-direction: column;\n            align-items: center;\n            justify-content: center;\n            text-align: center;\n            padding: 20px;\n        }\n\n        #countdown-cover h1 {\n            color: #E74C3C;\n            font-size: 48px;\n            margin-bottom: 30px;\n            text-shadow: 0 0 20px rgba(231, 76, 60, 0.8);\n            animation: pulse 2s ease-in-out infinite;\n        }\n\n        #countdown-timer {\n            color: #3498DB;\n            font-size: 72px;\n            font-weight: bold;\n            margin: 30px 0;\n            text-shadow: 0 0 30px rgba(52, 152, 219, 0.8);\n            letter-spacing: 5px;\n        }\n\n        #countdown-cover h2 {\n            color: #27AE60;\n            font-size: 36px;\n            margin-top: 30px;\n            text-shadow: 0 0 20px rgba(39, 174, 96, 0.8);\n            animation: glow 1.5s ease-in-out infinite alternate;\n        }\n\n        @keyframes pulse {\n            0%, 100% {\n                transform: scale(1);\n            }\n            50% {\n                transform: scale(1.05);\n            }\n        }\n\n        @keyframes glow {\n            from {\n                text-shadow: 0 0 20px rgba(39, 174, 96, 0.8);\n            }\n            to {\n                text-shadow: 0 0 40px rgba(39, 174, 96, 1);\n            }\n        }\n\n        @media (max-width: 768px) {\n            #countdown-cover h1 {\n                font-size: 32px;\n            }\n            \n            #countdown-timer {\n                font-size: 48px;\n            }\n            \n            #countdown-cover h2 {\n                font-size: 24px;\n            }\n        }\n\n        #ascii-bg {\n            position: fixed;\n            top: 0;\n            left: 0;\n            right: 0;\n            bottom: 0;\n            width: 100%;\n            height: 100%;\n            max-width: 100vw;\n            max-height: 100vh;\n            min-height: 100vh;\n            min-height: -webkit-fill-available;\n            z-index: 0;\n            pointer-events: none;\n            background: #000;\n            overflow: hidden;\n        }\n\n        #game-container {\n            position: relative;\n            z-index: 1;\n            display: flex;\n            flex-direction: column;\n            align-items: center;\n            justify-content: center;\n            min-height: 100vh;\n            min-height: -webkit-fill-available;\n            padding: 20px;\n            width: 100%;\n            max-width: 100vw;\n            overflow-x: hidden;\n        }\n\n        #game-board {\n            position: relative;\n            background: #FFEB3B !important;\n            background-color: #FFEB3B !important;\n            padding: 50px 50px 30px 50px;\n            box-shadow: \n                0 10px 30px rgba(0, 0, 0, 0.8),\n                inset 0 2px 10px rgba(255, 255, 255, 0.3),\n                inset 0 -2px 10px rgba(0, 0, 0, 0.2);\n            margin: 20px auto;\n            color-scheme: only light;\n            forced-color-adjust: none;\n            -webkit-print-color-adjust: exact;\n            print-color-adjust: exact;\n            filter: none !important;\n            clip-path: polygon(\n                46% 5%, \n                48% 3%, \n                50% 2%, \n                52% 3%, \n                54% 5%, \n                94% 93%, \n                95% 95%, \n                96% 97%, \n                50% 97%, \n                4% 97%, \n                5% 95%, \n                6% 93%\n            );\n            width: 480px;\n            height: 420px;\n            display: flex;\n            align-items: center;\n            justify-content: center;\n        }\n\n        canvas {\n            display: block;\n            cursor: grab;\n            touch-action: none;\n            margin-top: 0;\n        }\n\n        canvas:active {\n            cursor: grabbing;\n        }\n\n        #controls {\n            position: absolute;\n            bottom: 45px;\n            left: 50%;\n            transform: translateX(-50%);\n            display: flex;\n            gap: 15px;\n            z-index: 10;\n            pointer-events: auto;\n        }\n\n        button {\n            background: linear-gradient(135deg, #9B59B6 0%, #8E44AD 100%);\n            border: 2px solid #9B59B6;\n            color: #fff;\n            padding: 8px 16px;\n            font-family: 'Courier New', monospace;\n            font-size: 14px;\n            font-weight: bold;\n            cursor: pointer;\n            border-radius: 5px;\n            box-shadow: 0 4px 10px rgba(155, 89, 182, 0.4);\n            transition: all 0.3s;\n            pointer-events: auto;\n        }\n\n        button:hover {\n            background: linear-gradient(135deg, #BB8FCE 0%, #AF7AC5 100%);\n            border-color: #BB8FCE;\n            box-shadow: 0 6px 15px rgba(187, 143, 206, 0.6);\n            transform: translateY(-2px);\n        }\n\n        button:active {\n            transform: translateY(0);\n        }\n\n        #stats {\n            background: linear-gradient(135deg, rgba(25, 15, 35, 0.95) 0%, rgba(15, 10, 25, 0.95) 100%);\n            border: 3px solid #9B59B6;\n            padding: 20px;\n            border-radius: 10px;\n            max-width: 700px;\n            width: 100%;\n            margin-top: 20px;\n            box-shadow: \n                0 8px 20px rgba(0, 0, 0, 0.7),\n                inset 0 1px 0 rgba(155, 89, 182, 0.3),\n                inset 0 -1px 0 rgba(0, 0, 0, 0.5);\n            position: relative;\n            overflow: visible;\n        }\n\n        #stats::before {\n            content: '';\n            position: absolute;\n            top: -3px;\n            left: -3px;\n            right: -3px;\n            bottom: -3px;\n            background: linear-gradient(135deg, #9B59B6 0%, #8E44AD 50%, #9B59B6 100%);\n            border-radius: 10px;\n            z-index: -1;\n            opacity: 0.5;\n            filter: blur(8px);\n        }\n\n        #stats h2 {\n            color: #BB8FCE;\n            margin-bottom: 15px;\n            text-align: center;\n            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);\n        }\n\n        .stat-row {\n            display: flex;\n            justify-content: space-between;\n            align-items: center;\n            margin: 8px 0;\n            padding: 5px;\n            border-bottom: 1px solid rgba(155, 89, 182, 0.3);\n            flex-wrap: nowrap;\n            gap: 15px;\n        }\n\n        .stat-label {\n            color: #AF7AC5;\n            white-space: nowrap;\n            flex-shrink: 0;\n        }\n\n        .stat-value {\n            color: #D7BDE2;\n            font-weight: bold;\n            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);\n            white-space: nowrap;\n            flex-shrink: 0;\n            text-align: right;\n            min-width: fit-content;\n        }\n\n        #message {\n            position: fixed;\n            top: 50%;\n            left: 50%;\n            transform: translate(-50%, -50%);\n            background: rgba(0, 0, 0, 0.95);\n            border: 3px solid #3498DB;\n            padding: 30px 50px;\n            border-radius: 15px;\n            font-size: 24px;\n            color: #3498DB;\n            text-align: center;\n            z-index: 1000;\n            display: none;\n            box-shadow: 0 0 30px rgba(52, 152, 219, 0.5);\n        }\n\n        @media (max-width: 768px) {\n            html, body {\n                width: 100%;\n                height: 100%;\n                overflow-x: hidden;\n                position: fixed;\n                max-width: 100vw;\n            }\n\n            body {\n                min-height: 100vh;\n                min-height: -webkit-fill-available;\n            }\n\n            #ascii-bg {\n                width: 100%;\n                height: 100%;\n                max-width: 100vw;\n                max-height: 100vh;\n            }\n\n            #game-container {\n                overflow-y: auto;\n                overflow-x: hidden;\n                -webkit-overflow-scrolling: touch;\n                max-width: 100vw;\n            }\n\n            #game-board {\n                padding: 30px 30px 20px 30px;\n                width: 90vw;\n                max-width: 400px;\n                height: auto;\n                aspect-ratio: 1 \/ 0.875;\n                background: #FFEB3B !important;\n                background-color: #FFEB3B !important;\n                forced-color-adjust: none;\n            }\n\n            canvas {\n                max-width: 90%;\n                height: auto;\n            }\n\n            button {\n                padding: 6px 12px;\n                font-size: 12px;\n            }\n\n            #controls {\n                bottom: 35px;\n                gap: 10px;\n            }\n\n            #stats {\n                padding: 12px;\n                font-size: 13px;\n                max-width: 95%;\n                margin: 20px 10px;\n            }\n\n            #stats h2 {\n                font-size: 16px;\n                margin-bottom: 10px;\n            }\n\n            .stat-row {\n                flex-wrap: nowrap;\n                margin: 5px 0;\n                padding: 3px 0;\n                font-size: 11px;\n            }\n\n            .stat-label {\n                white-space: nowrap;\n                margin-right: 8px;\n                font-size: 11px;\n            }\n\n            .stat-value {\n                white-space: nowrap;\n                text-align: right;\n                flex-shrink: 0;\n                font-size: 11px;\n            }\n        }\n    <\/style>\n<\/head>\n<body>\n    <div id=\"countdown-cover\">\n        <h1>Going Bye Bye<\/h1>\n        <div id=\"countdown-timer\">--:--:--<\/div>\n        <h2>L2.3 Coming<\/h2>\n    <\/div>\n\n    <canvas id=\"ascii-bg\"><\/canvas>\n    \n    <div id=\"game-container\">\n        <div id=\"game-board\">\n            <canvas id=\"canvas\" width=\"400\" height=\"400\"><\/canvas>\n            <div id=\"controls\">\n                <button id=\"restart-btn\">New Game<\/button>\n                <button id=\"mute-btn\">Mute<\/button>\n            <\/div>\n        <\/div>\n\n        <div id=\"stats\">\n            <h2>\u2550\u2550\u2550 STATISTICS \u2550\u2550\u2550<\/h2>\n            <div class=\"stat-row\">\n                <span class=\"stat-label\">Current Start:<\/span>\n                <span class=\"stat-value\" id=\"current-start\">Position 5<\/span>\n            <\/div>\n            <div class=\"stat-row\">\n                <span class=\"stat-label\">Pegs Remaining:<\/span>\n                <span class=\"stat-value\" id=\"pegs-remaining\">14<\/span>\n            <\/div>\n            <div class=\"stat-row\">\n                <span class=\"stat-label\">Moves Made:<\/span>\n                <span class=\"stat-value\" id=\"moves-made\">0<\/span>\n            <\/div>\n            <div class=\"stat-row\">\n                <span class=\"stat-label\">Current Attempt:<\/span>\n                <span class=\"stat-value\" id=\"current-attempt\">1<\/span>\n            <\/div>\n            <h2 style=\"margin-top: 20px;\">\u2550\u2550\u2550 BY START POSITION \u2550\u2550\u2550<\/h2>\n            <div class=\"stat-row\">\n                <span class=\"stat-label\">Position 5:<\/span>\n                <span class=\"stat-value\" id=\"stats-5\">0 attempts \/ 0 wins<\/span>\n            <\/div>\n            <div class=\"stat-row\">\n                <span class=\"stat-label\">Position 8:<\/span>\n                <span class=\"stat-value\" id=\"stats-8\">0 attempts \/ 0 wins<\/span>\n            <\/div>\n            <div class=\"stat-row\">\n                <span class=\"stat-label\">Position 9:<\/span>\n                <span class=\"stat-value\" id=\"stats-9\">0 attempts \/ 0 wins<\/span>\n            <\/div>\n        <\/div>\n\n        <div id=\"message\"><\/div>\n    <\/div>\n\n    <script>\n        \/\/ Anti-tampering: Store original Date constructor\n        (function() {\n            const _0x4d2a = Date;\n            const _0x8f1b = _0x4d2a.now;\n            const _0x3c9e = _0x4d2a.prototype.getTime;\n            \n            \/\/ Obfuscated countdown logic\n            const _0x7a3d = function() {\n                const _0x1f8e = new _0x4d2a();\n                const _0x9c4b = _0x3c9e.call(_0x1f8e) + (_0x1f8e.getTimezoneOffset() * 0xea60);\n                const _0x5d7f = -0x7 * 0x36ee80;\n                const _0x2b6c = new _0x4d2a(_0x9c4b + _0x5d7f);\n                const _0x8e4a = new _0x4d2a(_0x2b6c);\n                _0x8e4a.setHours(0x18, 0x0, 0x0, 0x0);\n                const _0x6f2d = _0x8e4a - _0x2b6c;\n                \n                \/\/ Verify Date hasn't been tampered with\n                if (typeof _0x4d2a.now !== 'function' || _0x4d2a !== Date || _0x3c9e !== Date.prototype.getTime) {\n                    document.getElementById('countdown-timer').textContent = 'ERROR';\n                    return;\n                }\n                \n                if (_0x6f2d <= 0x0) {\n                    document.getElementById('countdown-timer').textContent = '00:00:00';\n                    document.getElementById('countdown-cover').querySelector('h1').textContent = 'TIME\\'S UP!';\n                    return;\n                }\n                \n                const _0x3a8f = Math.floor(_0x6f2d \/ 0x36ee80);\n                const _0x4b9c = Math.floor((_0x6f2d % 0x36ee80) \/ 0xea60);\n                const _0x7c2e = Math.floor((_0x6f2d % 0xea60) \/ 0x3e8);\n                \n                const _0x9d5a = \n                    String(_0x3a8f).padStart(0x2, '0') + ':' +\n                    String(_0x4b9c).padStart(0x2, '0') + ':' +\n                    String(_0x7c2e).padStart(0x2, '0');\n                \n                document.getElementById('countdown-timer').textContent = _0x9d5a;\n            };\n            \n            \/\/ Detect dev tools opening\n            let _0xdev = false;\n            const _0xcheck = function() {\n                const _0xstart = new _0x4d2a();\n                debugger;\n                const _0xend = new _0x4d2a();\n                if (_0xend - _0xstart > 100) {\n                    _0xdev = true;\n                }\n            };\n            setInterval(_0xcheck, 1000);\n            \n            \/\/ Multiple update intervals with cross-checking\n            _0x7a3d();\n            const _0xint1 = setInterval(_0x7a3d, 0x3e8);\n            const _0xint2 = setInterval(_0x7a3d, 0x3e7);\n            \n            \/\/ Prevent interval clearing\n            const _0xorigClear = window.clearInterval;\n            window.clearInterval = function(id) {\n                if (id !== _0xint1 && id !== _0xint2) {\n                    _0xorigClear(id);\n                }\n            };\n        })();\n\n        const asciiBg = document.getElementById('ascii-bg');\n        const asciiCtx = asciiBg.getContext('2d');\n        const chars = '01\u2591\u2592\u2593\u2588\u2584\u258c\u2590\u2580\u25a0\u25a1\u25aa\u25ab';\n        \n        const msgData = [80,65,82,73,83,73,83,82,69,65,68,89,83,69,84,71,79];\n        const secretMessage = String.fromCharCode(...msgData);\n        let messageFrameCount = 0;\n\n        function resizeASCIICanvas() {\n            const vw = window.innerWidth;\n            const vh = window.innerHeight;\n            asciiBg.width = vw;\n            asciiBg.height = vh;\n            asciiBg.style.width = '100%';\n            asciiBg.style.height = '100%';\n        }\n\n        function drawASCIIBackground() {\n            asciiCtx.fillStyle = '#000';\n            asciiCtx.fillRect(0, 0, asciiBg.width, asciiBg.height);\n            \n            asciiCtx.font = '10px Courier New';\n            asciiCtx.fillStyle = 'rgba(93, 173, 226, 0.3)';\n            \n            const cols = Math.ceil(asciiBg.width \/ 10) + 1;\n            const rows = Math.ceil(asciiBg.height \/ 10) + 1;\n            \n            messageFrameCount++;\n            const showMessage = messageFrameCount % 50 === 0; \n            \n            for (let i = 0; i < rows; i++) {\n                for (let j = 0; j < cols; j++) {\n                    let char = chars[Math.floor(Math.random() * chars.length)];\n                    \n                    if (showMessage && Math.random() < 0.008) { \n                        const msgIndex = Math.floor(Math.random() * secretMessage.length);\n                        char = secretMessage[msgIndex];\n                        asciiCtx.font = '20px Courier New'; \n                        asciiCtx.fillStyle = 'rgba(255, 215, 0, 0.4)'; \n                        asciiCtx.fillText(char, j * 10, i * 10 + 8);\n                        asciiCtx.font = '10px Courier New'; \n                        continue;\n                    }\n                    \n                    asciiCtx.fillStyle = 'rgba(93, 173, 226, 0.3)';\n                    asciiCtx.fillText(char, j * 10, i * 10 + 8);\n                }\n            }\n        }\n\n        resizeASCIICanvas();\n        drawASCIIBackground();\n        setInterval(drawASCIIBackground, 200);\n        window.addEventListener('resize', () => {\n            resizeASCIICanvas();\n            drawASCIIBackground();\n        });\n        \n        window.addEventListener('orientationchange', () => {\n            setTimeout(() => {\n                resizeASCIICanvas();\n                drawASCIIBackground();\n            }, 100);\n        });\n        \n        if ('visualViewport' in window) {\n            window.visualViewport.addEventListener('resize', () => {\n                resizeASCIICanvas();\n                drawASCIIBackground();\n            });\n        }\n\n        const c1 = [0x50,0x41,0x52,0x49,0x53];\n        const c2 = [0x49,0x53];\n        const c3 = [0x52,0x45,0x41,0x44,0x59];\n        const c4 = [0x53,0x45,0x54];\n        const c5 = [0x47,0x4F];\n        const hexMsg = [...c1,...[0x20],...c2,...[0x20],...c3,...[0x20],...c4,...[0x20],...c5].map(x => x.toString(16).toUpperCase()).join('.');\n        console.log('%c\u2588\u2593\u2592\u2591 ' + hexMsg + ' \u2591\u2592\u2593\u2588', 'color: #FFD700; font-weight: bold;');\n\n        let audioContext;\n        let oscillator1, oscillator2;\n        let gainNode, filterNode;\n        let isMuted = false;\n\n        function initAudio() {\n            if (!audioContext) {\n                audioContext = new (window.AudioContext || window.webkitAudioContext)();\n                \n                filterNode = audioContext.createBiquadFilter();\n                filterNode.type = 'lowpass';\n                filterNode.frequency.value = 1200; \n                filterNode.Q.value = 0.5; \n                \n                gainNode = audioContext.createGain();\n                gainNode.gain.value = 0.05; \n                \n                filterNode.connect(gainNode);\n                gainNode.connect(audioContext.destination);\n                \n                playBackgroundMusic();\n            } else if (audioContext.state === 'suspended') {\n                audioContext.resume().then(() => {\n                    if (!oscillator1 || !oscillator2) {\n                        playBackgroundMusic();\n                    }\n                });\n            }\n        }\n\n        function playBackgroundMusic() {\n            if (oscillator1) oscillator1.stop();\n            if (oscillator2) oscillator2.stop();\n\n            oscillator1 = audioContext.createOscillator();\n            oscillator1.type = 'triangle'; \n            \n            oscillator2 = audioContext.createOscillator();\n            oscillator2.type = 'sine'; \n            \n            const melody = [196, 220, 247, 262, 220, 196, 175, 196]; \n            const bass = [98, 131, 147, 131]; \n            let noteIndex = 0;\n            let bassIndex = 0;\n            \n            oscillator1.frequency.value = melody[0];\n            oscillator2.frequency.value = bass[0];\n            \n            oscillator1.connect(filterNode);\n            oscillator2.connect(filterNode);\n            \n            oscillator1.start();\n            oscillator2.start();\n\n            setInterval(() => {\n                if (!isMuted && oscillator1) {\n                    noteIndex = (noteIndex + 1) % melody.length;\n                    bassIndex = Math.floor(noteIndex \/ 2) % bass.length;\n                    \n                    oscillator1.frequency.setValueAtTime(melody[noteIndex], audioContext.currentTime);\n                    oscillator2.frequency.setValueAtTime(bass[bassIndex], audioContext.currentTime);\n                    \n                    filterNode.frequency.setValueAtTime(1200, audioContext.currentTime);\n                }\n            }, 500); \n        }\n\n        function toggleMute() {\n            isMuted = !isMuted;\n            if (gainNode) {\n                gainNode.gain.value = isMuted ? 0 : 0.05;\n            }\n            document.getElementById('mute-btn').textContent = isMuted ? 'Unmute' : 'Mute';\n        }\n\n        const canvas = document.getElementById('canvas');\n        const ctx = canvas.getContext('2d');\n\n        const positions = [\n            {row: 0, col: 0, x: 200, y: 60},\n            {row: 1, col: 0, x: 170, y: 110},\n            {row: 1, col: 1, x: 230, y: 110},\n            {row: 2, col: 0, x: 140, y: 160},\n            {row: 2, col: 1, x: 200, y: 160},\n            {row: 2, col: 2, x: 260, y: 160},\n            {row: 3, col: 0, x: 110, y: 210},\n            {row: 3, col: 1, x: 170, y: 210},\n            {row: 3, col: 2, x: 230, y: 210},\n            {row: 3, col: 3, x: 290, y: 210},\n            {row: 4, col: 0, x: 80, y: 260},\n            {row: 4, col: 1, x: 140, y: 260},\n            {row: 4, col: 2, x: 200, y: 260},\n            {row: 4, col: 3, x: 260, y: 260},\n            {row: 4, col: 4, x: 320, y: 260}\n        ];\n\n        const validJumps = [\n            [0,1,3], [0,2,5], [1,3,6], [1,4,8], [2,4,7], [2,5,9],\n            [3,1,0], [3,4,5], [3,6,10], [3,7,12], [4,7,11], [4,8,13],\n            [5,2,0], [5,4,3], [5,8,12], [5,9,14], [6,3,1], [6,7,8],\n            [7,4,2], [7,8,9], [8,4,1], [8,7,6], [9,5,2], [9,8,7],\n            [10,6,3], [10,11,12], [11,7,4], [11,12,13], [12,7,3], [12,8,5],\n            [12,11,10], [12,13,14], [13,8,4], [13,12,11], [14,9,5], [14,13,12]\n        ];\n\n        let board = [];\n        let selectedPeg = -1;\n        let moveHistory = [];\n        let startTime;\n        let currentStartPosition = 4;\n        \n        let stats = {\n            5: { attempts: 0, wins: 0, totalTime: 0 },\n            8: { attempts: 0, wins: 0, totalTime: 0 },\n            9: { attempts: 0, wins: 0, totalTime: 0 }\n        };\n\n        const pegColors = ['#E74C3C', '#3498DB', '#27AE60'];\n        \n        const cfg = [0x33, 0xFD, 0xB6, 0x25];\n\n        function initBoard(emptyPos = 4) {\n            board = Array(15).fill(1);\n            board[emptyPos] = 0;\n            selectedPeg = -1;\n            moveHistory = [];\n            currentStartPosition = emptyPos;\n            startTime = Date.now();\n            \n            stats[emptyPos + 1].attempts++;\n            updateStats();\n            draw();\n        }\n\n        function drawPeg(index, highlight = false) {\n            const pos = positions[index];\n            const radius = 18;\n            \n            ctx.fillStyle = 'rgba(0, 0, 0, 0.3)';\n            ctx.beginPath();\n            ctx.arc(pos.x + 2, pos.y + 2, radius, 0, Math.PI * 2);\n            ctx.fill();\n            \n            if (board[index] === 1) {\n                const colorIndex = index % pegColors.length;\n                const gradient = ctx.createRadialGradient(pos.x - 5, pos.y - 5, 2, pos.x, pos.y, radius);\n                gradient.addColorStop(0, pegColors[colorIndex]);\n                gradient.addColorStop(1, shadeColor(pegColors[colorIndex], -40));\n                \n                ctx.fillStyle = gradient;\n                ctx.beginPath();\n                ctx.arc(pos.x, pos.y, radius, 0, Math.PI * 2);\n                ctx.fill();\n                \n                if (highlight) {\n                    ctx.strokeStyle = '#9B59B6';\n                    ctx.lineWidth = 3;\n                    ctx.stroke();\n                }\n                \n                ctx.fillStyle = 'rgba(255, 255, 255, 0.3)';\n                ctx.beginPath();\n                ctx.arc(pos.x - 5, pos.y - 5, 6, 0, Math.PI * 2);\n                ctx.fill();\n            } else {\n                ctx.fillStyle = '#2C1810';\n                ctx.beginPath();\n                ctx.arc(pos.x, pos.y, radius - 3, 0, Math.PI * 2);\n                ctx.fill();\n                \n                ctx.strokeStyle = '#1A0F08';\n                ctx.lineWidth = 2;\n                ctx.stroke();\n            }\n        }\n\n        function shadeColor(color, percent) {\n            const num = parseInt(color.replace('#', ''), 16);\n            const amt = Math.round(2.55 * percent);\n            const R = (num >> 16) + amt;\n            const G = (num >> 8 & 0x00FF) + amt;\n            const B = (num & 0x0000FF) + amt;\n            return '#' + (0x1000000 + (R < 255 ? R < 1 ? 0 : R : 255) * 0x10000 +\n                (G < 255 ? G < 1 ? 0 : G : 255) * 0x100 +\n                (B < 255 ? B < 1 ? 0 : B : 255))\n                .toString(16).slice(1);\n        }\n\n        function assembleBytes(arr) {\n            return (arr[0] << 24) | (arr[1] << 16) | (arr[2] << 8) | arr[3];\n        }\n\n        function draw() {\n            ctx.clearRect(0, 0, canvas.width, canvas.height);\n            \n            ctx.strokeStyle = 'rgba(52, 152, 219, 0.2)';\n            ctx.lineWidth = 2;\n            validJumps.forEach(([from, over, to]) => {\n                ctx.beginPath();\n                ctx.moveTo(positions[from].x, positions[from].y);\n                ctx.lineTo(positions[to].x, positions[to].y);\n                ctx.stroke();\n            });\n            \n            for (let i = 0; i < 15; i++) {\n                drawPeg(i, i === selectedPeg);\n            }\n            \n            ctx.fillStyle = 'rgba(52, 152, 219, 0.3)';\n            ctx.font = '10px Courier New';\n            ctx.textAlign = 'center';\n            positions.forEach((pos, i) => {\n                ctx.fillText(i + 1, pos.x, pos.y + 35);\n            });\n        }\n\n        function getClickedPeg(x, y) {\n            const rect = canvas.getBoundingClientRect();\n            const scaleX = canvas.width \/ rect.width;\n            const scaleY = canvas.height \/ rect.height;\n            const canvasX = (x - rect.left) * scaleX;\n            const canvasY = (y - rect.top) * scaleY;\n            \n            for (let i = 0; i < positions.length; i++) {\n                const pos = positions[i];\n                const dx = canvasX - pos.x;\n                const dy = canvasY - pos.y;\n                const distance = Math.sqrt(dx * dx + dy * dy);\n                if (distance < 20) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n\n        function isValidJump(from, to) {\n            if (board[from] !== 1 || board[to] !== 0) return -1;\n            \n            for (const [f, over, t] of validJumps) {\n                if (f === from && t === to && board[over] === 1) {\n                    return over;\n                }\n            }\n            return -1;\n        }\n\n        function makeMove(from, over, to) {\n            moveHistory.push([...board]);\n            board[from] = 0;\n            board[over] = 0;\n            board[to] = 1;\n            selectedPeg = -1;\n            \n            updateStats();\n            draw();\n            checkGameState();\n        }\n\n        function hasLegalMoves() {\n            for (const [from, over, to] of validJumps) {\n                if (board[from] === 1 && board[over] === 1 && board[to] === 0) {\n                    return true;\n                }\n            }\n            return false;\n        }\n\n        function countPegs() {\n            return board.reduce((sum, peg) => sum + peg, 0);\n        }\n\n        function checkGameState() {\n            const pegsLeft = countPegs();\n            \n            if (pegsLeft === 1) {\n                if (board[currentStartPosition] === 1) {\n                    const elapsed = Math.floor((Date.now() - startTime) \/ 1000);\n                    stats[currentStartPosition + 1].wins++;\n                    stats[currentStartPosition + 1].totalTime += elapsed;\n                    \n                    const r = Math.floor(Math.random() * 99) + 1;\n                    const code = r * assembleBytes(cfg);\n                    \n                    updateStats();\n                    showMessage(code, 6000);\n                    setTimeout(() => newGame(), 6500);\n                } else {\n                    const r = Math.floor(Math.random() * 99) + 1;\n                    const code = r * assembleBytes(cfg);\n                    \n                    showMessage(code, 6000);\n                    setTimeout(() => newGame(), 6500);\n                }\n            } else if (!hasLegalMoves()) {\n                showMessage('No legal moves!<br>Starting new game...', 2000);\n                setTimeout(() => newGame(), 2500);\n            }\n        }\n\n        function showMessage(text, duration) {\n            const msg = document.getElementById('message');\n            msg.innerHTML = text;\n            msg.style.display = 'block';\n            setTimeout(() => {\n                msg.style.display = 'none';\n            }, duration);\n        }\n\n        function updateStats() {\n            document.getElementById('pegs-remaining').textContent = countPegs();\n            document.getElementById('moves-made').textContent = moveHistory.length;\n            document.getElementById('current-attempt').textContent = \n                stats[currentStartPosition + 1].attempts;\n            document.getElementById('current-start').textContent = \n                `Position ${currentStartPosition + 1}`;\n            \n            [5, 8, 9].forEach(pos => {\n                const s = stats[pos];\n                const avgTime = s.wins > 0 ? Math.floor(s.totalTime \/ s.wins) : 0;\n                const mins = Math.floor(avgTime \/ 60);\n                const secs = avgTime % 60;\n                const timeStr = s.wins > 0 ? ` \/ Avg: ${mins}:${secs.toString().padStart(2, '0')}` : '';\n                document.getElementById(`stats-${pos}`).textContent = \n                    `${s.attempts} attempts \/ ${s.wins} wins${timeStr}`;\n            });\n        }\n\n        function newGame() {\n            const hardStarts = [4, 7, 8];\n            const randomStart = hardStarts[Math.floor(Math.random() * hardStarts.length)];\n            initBoard(randomStart);\n        }\n\n        let dragStart = null;\n\n        canvas.addEventListener('mousedown', (e) => {\n            initAudio();\n            const peg = getClickedPeg(e.clientX, e.clientY);\n            if (peg !== -1 && board[peg] === 1) {\n                selectedPeg = peg;\n                dragStart = peg;\n                draw();\n            }\n        });\n\n        canvas.addEventListener('mouseup', (e) => {\n            if (dragStart !== -1) {\n                const target = getClickedPeg(e.clientX, e.clientY);\n                if (target !== -1 && target !== dragStart) {\n                    const over = isValidJump(dragStart, target);\n                    if (over !== -1) {\n                        makeMove(dragStart, over, target);\n                    }\n                }\n                dragStart = -1;\n                selectedPeg = -1;\n                draw();\n            }\n        });\n\n        canvas.addEventListener('touchstart', (e) => {\n            initAudio();\n            e.preventDefault();\n            const touch = e.touches[0];\n            const peg = getClickedPeg(touch.clientX, touch.clientY);\n            if (peg !== -1 && board[peg] === 1) {\n                selectedPeg = peg;\n                dragStart = peg;\n                draw();\n            }\n        });\n\n        canvas.addEventListener('touchend', (e) => {\n            e.preventDefault();\n            if (dragStart !== -1) {\n                const touch = e.changedTouches[0];\n                const target = getClickedPeg(touch.clientX, touch.clientY);\n                if (target !== -1 && target !== dragStart) {\n                    const over = isValidJump(dragStart, target);\n                    if (over !== -1) {\n                        makeMove(dragStart, over, target);\n                    }\n                }\n                dragStart = -1;\n                selectedPeg = -1;\n                draw();\n            }\n        });\n\n        document.getElementById('restart-btn').addEventListener('click', newGame);\n        document.getElementById('mute-btn').addEventListener('click', () => {\n            initAudio();\n            toggleMute();\n        });\n\n        initBoard(4);\n        \n        document.addEventListener('click', () => {\n            initAudio();\n        }, { once: true });\n    <\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-145","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/trezor.quest\/wp-json\/wp\/v2\/pages\/145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trezor.quest\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/trezor.quest\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/trezor.quest\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/trezor.quest\/wp-json\/wp\/v2\/comments?post=145"}],"version-history":[{"count":28,"href":"https:\/\/trezor.quest\/wp-json\/wp\/v2\/pages\/145\/revisions"}],"predecessor-version":[{"id":364,"href":"https:\/\/trezor.quest\/wp-json\/wp\/v2\/pages\/145\/revisions\/364"}],"wp:attachment":[{"href":"https:\/\/trezor.quest\/wp-json\/wp\/v2\/media?parent=145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}