{"id":1209,"date":"2025-03-08T10:40:58","date_gmt":"2025-03-08T08:40:58","guid":{"rendered":"https:\/\/luddiitti.fi\/blog\/?p=1209"},"modified":"2025-03-08T10:41:58","modified_gmt":"2025-03-08T08:41:58","slug":"schrodingers-cat-simulator","status":"publish","type":"post","link":"https:\/\/luddiitti.fi\/blog\/uncategorized\/schrodingers-cat-simulator\/","title":{"rendered":"Schr\u00f6dinger&#8217;s Cat Paradox Simulator"},"content":{"rendered":"\n <style>\n    body {\n      font-family: Arial, sans-serif;\n      background: #f0f0f0;\n      text-align: center;\n      padding: 20px;\n    }\n    #simulation-container {\n      margin: auto;\n      width: 320px;\n      padding: 20px;\n      background: #fff;\n      border: 2px solid #ccc;\n      border-radius: 8px;\n      box-shadow: 0 4px 8px rgba(0,0,0,0.1);\n    }\n    #box {\n      position: relative;\n      width: 100%;\n      height: 200px;\n      border: 2px dashed #888;\n      margin-bottom: 20px;\n      display: flex;\n      align-items: center;\n      justify-content: center;\n      overflow: hidden;\n    }\n    #catState {\n      font-size: 20px;\n      font-weight: bold;\n      transition: opacity 0.5s;\n    }\n    .alive {\n      color: green;\n    }\n    .dead {\n      color: red;\n    }\n    .superposition {\n      color: #555;\n    }\n    button {\n      padding: 10px 20px;\n      font-size: 16px;\n      margin: 5px;\n      border: none;\n      border-radius: 4px;\n      cursor: pointer;\n    }\n    button:disabled {\n      background: #ccc;\n      cursor: not-allowed;\n    }\n    #openButton {\n      background: #0077cc;\n      color: white;\n    }\n    #resetButton {\n      background: #ff9900;\n      color: white;\n    }\n  <\/style>\n<\/head>\n<body>\n  <p>\n    In this playful simulation, the cat is initially in a quantum superposition\u2014neither definitively alive nor dead. \n    Click the \"Open Box (Observe)\" button to collapse the state and see whether the cat is alive or dead.\n  <\/p>\n  <div id=\"simulation-container\">\n    <div id=\"box\">\n      <div id=\"catState\" class=\"superposition\">Cat in superposition...<\/div>\n    <\/div>\n    <button id=\"openButton\">Open Box (Observe)<\/button>\n    <button id=\"resetButton\" disabled>Reset<\/button>\n  <\/div>\n\n  <script>\n    const catStateDiv = document.getElementById('catState');\n    const openButton = document.getElementById('openButton');\n    const resetButton = document.getElementById('resetButton');\n\n    \/\/ Simulate observation: collapse the superposition into a random outcome.\n    function observeCat() {\n      \/\/ Randomly decide outcome (50\/50 chance)\n      const outcome = Math.random() < 0.5 ? 'alive' : 'dead';\n      if (outcome === 'alive') {\n        catStateDiv.textContent = \"The cat is alive! \ud83d\udc31\";\n        catStateDiv.classList.remove('superposition', 'dead');\n        catStateDiv.classList.add('alive');\n      } else {\n        catStateDiv.textContent = \"The cat is dead... \ud83d\udc80\";\n        catStateDiv.classList.remove('superposition', 'alive');\n        catStateDiv.classList.add('dead');\n      }\n      openButton.disabled = true;\n      resetButton.disabled = false;\n    }\n\n    \/\/ Reset the simulation back to superposition.\n    function resetSimulation() {\n      catStateDiv.textContent = \"Cat in superposition...\";\n      catStateDiv.className = \"superposition\";\n      openButton.disabled = false;\n      resetButton.disabled = true;\n    }\n\n    openButton.addEventListener('click', observeCat);\n    resetButton.addEventListener('click', resetSimulation);\n  <\/script>\n","protected":false},"excerpt":{"rendered":"<p>In this playful simulation, the cat is initially in a quantum superposition\u2014neither definitively alive nor dead. Click the \"Open Box (Observe)\" button to collapse the state and see whether the cat is alive or dead. Cat in superposition... Open Box (Observe) Reset<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-1209","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-uncategorized","7":"h-entry","8":"hentry","9":"h-as-article"},"_links":{"self":[{"href":"https:\/\/luddiitti.fi\/blog\/wp-json\/wp\/v2\/posts\/1209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/luddiitti.fi\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/luddiitti.fi\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/luddiitti.fi\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/luddiitti.fi\/blog\/wp-json\/wp\/v2\/comments?post=1209"}],"version-history":[{"count":4,"href":"https:\/\/luddiitti.fi\/blog\/wp-json\/wp\/v2\/posts\/1209\/revisions"}],"predecessor-version":[{"id":1225,"href":"https:\/\/luddiitti.fi\/blog\/wp-json\/wp\/v2\/posts\/1209\/revisions\/1225"}],"wp:attachment":[{"href":"https:\/\/luddiitti.fi\/blog\/wp-json\/wp\/v2\/media?parent=1209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/luddiitti.fi\/blog\/wp-json\/wp\/v2\/categories?post=1209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/luddiitti.fi\/blog\/wp-json\/wp\/v2\/tags?post=1209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}