Atomic Studio
/
神経衰弱(テンプレートから)
0部品・0〜数百トークン
↩ 戻す
履歴
複製
💬 ことばで直す
▶ Run
🔗 共有
🚀 デプロイ
⏹
☰
▷ プレビュー
</> コード
🖥 PC
📱 スマホ
↻ 新タブ
atomic.studio/s/3726
📄 index.html
コードを直接編集して「適用」でプレビューに反映
適用 ▷
<!doctype html><html lang="ja"><head><meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"><title>神経衰弱</title> <style> html,body{margin:0;height:100%;background:#0e1525;color:#f5f9fc;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif} .wrap{min-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:16px;box-sizing:border-box} h1{font-size:18px;margin:0;font-weight:700} .hud{font-size:14px;color:#9da9bd} .hint{font-size:12px;color:#6b7689} canvas{background:var(--bg,#11131f);border-radius:14px;box-shadow:0 12px 48px #0008;max-width:96vw;height:auto;touch-action:none} .btn{background:#6366f1;color:#fff;border:0;border-radius:10px;padding:8px 16px;font-size:14px;font-weight:600;cursor:pointer} #board{display:grid;gap:6px} .cell{display:flex;align-items:center;justify-content:center;border-radius:8px;font-weight:700;user-select:none;cursor:pointer} </style></head><body><div class="wrap"> <h1 id="title">神経衰弱</h1><div class="hud" id="hud">めくり <span id="mv">0</span> / 揃い <span id="mt">0</span></div> <div id="board" style="grid-template-columns:repeat(4,64px);grid-auto-rows:64px"></div> <div class="hint" id="hint">カードをめくってペアを揃える</div><button class="btn" id="restart">もう一度</button> </div> <script id="game-data" type="application/json">{"title": "神経衰弱", "bg": "#1c2333", "back": "#6366f1", "pairs": 6, "faces": ["🍎", "🍌", "🍇", "🍓", "🍑", "🍊", "🍉", "🥝"]}</script> <script> const DATA=JSON.parse(document.getElementById('game-data').textContent); document.getElementById('title').textContent=DATA.title||document.title; if(DATA.bg)document.documentElement.style.setProperty('--bg',DATA.bg); const bd=document.getElementById('board');let deck,open,matched,mv; function shuffle(a){for(let i=a.length-1;i>0;i--){const j=(Math.random()*(i+1))|0;[a[i],a[j]]=[a[j],a[i]];}return a;} function reset(){const f=DATA.faces.slice(0,DATA.pairs);deck=shuffle([...f,...f].map((face,i)=>({face,i,up:0,done:0}))); open=[];matched=0;mv=0;document.getElementById('mv').textContent=0;document.getElementById('mt').textContent=0;render();} function flip(c){if(c.up||c.done||open.length>=2)return;c.up=1;open.push(c);render(); if(open.length===2){mv++;document.getElementById('mv').textContent=mv; if(open[0].face===open[1].face){open.forEach(o=>o.done=1);matched++;document.getElementById('mt').textContent=matched;open=[];render();} else{const o=open;open=[];setTimeout(()=>{o.forEach(c=>c.up=0);render();},600);}}} function render(){bd.innerHTML='';deck.forEach(c=>{const d=document.createElement('div');d.className='cell';d.style.height='64px';d.style.fontSize='30px'; d.style.background=c.up||c.done?'#0b1020':DATA.back;d.style.opacity=c.done?.4:1;d.textContent=c.up||c.done?c.face:'';d.onclick=()=>flip(c);bd.appendChild(d);});} document.getElementById('restart').onclick=reset;reset(); window.__state=()=>({mv,matched,up:deck.filter(c=>c.up).length});window.__input=()=>{flip(deck[0]);}; </script></body></html>
▸ コンソール
0部品・0〜数百トークン
✕