{"id":218,"date":"2026-05-25T14:25:35","date_gmt":"2026-05-25T14:25:35","guid":{"rendered":"https:\/\/dailypuzzle.us\/?page_id=218"},"modified":"2026-05-25T15:01:59","modified_gmt":"2026-05-25T15:01:59","slug":"mahjong-puzzle","status":"publish","type":"page","link":"https:\/\/dailypuzzle.us\/?page_id=218","title":{"rendered":"Mahjong"},"content":{"rendered":"\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<div id=\"mahjong-daily-container\">\n  <h3 id=\"mahjong-date-title\"><\/h3>\n  <div id=\"mahjong-grid\"><\/div>\n  <button id=\"mahjong-reset\">Replay today&#8217;s puzzle<\/button>\n  <p id=\"mahjong-status\"><\/p>\n<\/div>\n\n<style>\n  #mahjong-grid {\n    display: grid;\n    grid-template-columns: repeat(6, 1fr);\n    gap: 6px;\n    margin: 10px 0;\n  }\n  .mj-tile {\n    background: #fff8e6;\n    border: 1px solid #d8c9a3;\n    border-radius: 4px;\n    padding: 10px 0;\n    font-size: 22px;\n    cursor: pointer;\n    text-align: center;\n  }\n  .mj-selected { outline: 2px solid #2b8cff; background: #eef5ff; }\n  .mj-removed { visibility: hidden; }\n<\/style>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n  const TILE_SYMBOLS = [\"\ud83c\udc07\",\"\ud83c\udc08\",\"\ud83c\udc09\",\"\ud83c\udc0a\",\"\ud83c\udc0b\",\"\ud83c\udc0c\",\"\ud83c\udc0d\",\"\ud83c\udc0e\",\"\ud83c\udc0f\",\"\ud83c\udc10\",\"\ud83c\udc11\",\"\ud83c\udc12\"];\n\n  function seedShuffle(arr, seed) {\n    function xmur3(str) {\n      let h = 1779033703 ^ str.length;\n      for (let i = 0; i < str.length; i++) {\n        h = Math.imul(h ^ str.charCodeAt(i), 3432918353);\n        h = (h << 13) | (h >>> 19);\n      }\n      return function () {\n        h = Math.imul(h ^ (h >>> 16), 2246822507);\n        h = Math.imul(h ^ (h >>> 13), 3266489909);\n        return (h ^= h >>> 16) >>> 0;\n      };\n    }\n    function mulberry32(a) {\n      return function () {\n        let t = (a += 0x6D2B79F5);\n        t = Math.imul(t ^ (t >>> 15), t | 1);\n        t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n        return ((t ^ (t >>> 14)) >>> 0) \/ 4294967296;\n      };\n    }\n    const seedFn = xmur3(seed);\n    const rand = mulberry32(seedFn());\n    const a = arr.slice();\n    for (let i = a.length - 1; i > 0; i--) {\n      const j = Math.floor(rand() * (i + 1));\n      [a[i], a[j]] = [a[j], a[i]];\n    }\n    return a;\n  }\n\n  function todayKey() {\n    const d = new Date();\n    return `${d.getFullYear()}-${d.getMonth()+1}-${d.getDate()}`;\n  }\n\n  function build() {\n    const key = todayKey();\n    let tiles = [];\n    TILE_SYMBOLS.forEach(s => tiles.push(s, s));\n    return seedShuffle(tiles, key);\n  }\n\n  function render() {\n    const grid = document.getElementById(\"mahjong-grid\");\n    const title = document.getElementById(\"mahjong-date-title\");\n    const status = document.getElementById(\"mahjong-status\");\n\n    const tiles = build();\n    grid.innerHTML = \"\";\n    status.textContent = \"Match all pairs.\";\n\n    let first = null;\n    let remaining = TILE_SYMBOLS.length;\n\n    tiles.forEach((sym) => {\n      const t = document.createElement(\"div\");\n      t.className = \"mj-tile\";\n      t.textContent = sym;\n      t.dataset.value = sym;\n\n      t.onclick = () => {\n        if (t.classList.contains(\"mj-removed\")) return;\n\n        if (!first) {\n          first = t;\n          t.classList.add(\"mj-selected\");\n          return;\n        }\n\n        if (t === first) {\n          t.classList.remove(\"mj-selected\");\n          first = null;\n          return;\n        }\n\n        t.classList.add(\"mj-selected\");\n\n        if (t.dataset.value === first.dataset.value) {\n          setTimeout(() => {\n            t.classList.add(\"mj-removed\");\n            first.classList.add(\"mj-removed\");\n            t.classList.remove(\"mj-selected\");\n            first.classList.remove(\"mj-selected\");\n            first = null;\n            remaining--;\n            if (remaining === 0) status.textContent = \"You cleared it!\";\n          }, 150);\n        } else {\n          setTimeout(() => {\n            t.classList.remove(\"mj-selected\");\n            first.classList.remove(\"mj-selected\");\n            first = null;\n          }, 200);\n        }\n      };\n\n      grid.appendChild(t);\n    });\n  }\n\n  document.getElementById(\"mahjong-reset\").onclick = render;\n  render();\n});\n<\/script>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Replay today&#8217;s puzzle<\/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-218","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/dailypuzzle.us\/index.php?rest_route=\/wp\/v2\/pages\/218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dailypuzzle.us\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/dailypuzzle.us\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/dailypuzzle.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dailypuzzle.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=218"}],"version-history":[{"count":6,"href":"https:\/\/dailypuzzle.us\/index.php?rest_route=\/wp\/v2\/pages\/218\/revisions"}],"predecessor-version":[{"id":232,"href":"https:\/\/dailypuzzle.us\/index.php?rest_route=\/wp\/v2\/pages\/218\/revisions\/232"}],"wp:attachment":[{"href":"https:\/\/dailypuzzle.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}