Skip to content

Instantly share code, notes, and snippets.

@cesarkohl
Last active January 9, 2026 13:43
Show Gist options
  • Select an option

  • Save cesarkohl/0c2c3eabbc09ec30b9ab431084fc382f to your computer and use it in GitHub Desktop.

Select an option

Save cesarkohl/0c2c3eabbc09ec30b9ab431084fc382f to your computer and use it in GitHub Desktop.
<!doctypehtml><html><meta charset=UTF-8><meta content="width=device-width,initial-scale=1"name=viewport><style>*{margin:0;padding:0;box-sizing:border-box}body{background:#130c36;min-height:calc(100vh - 80px);display:flex;justify-content:center;align-items:center}.t1_b{display:grid;grid:repeat(3,100px)/repeat(3,100px);position:relative}.t1_b.di{pointer-events:none;opacity:.7}.t1_c{display:flex;position:relative;justify-content:center;align-items:center;cursor:pointer;border:1px solid #4d88f9}.t1_c:nth-child(3n){border-right:0}.t1_c:nth-child(3n+1){border-left:0}.t1_c:nth-child(-n+3){border-top:0}.t1_c:nth-child(n+7){border-bottom:0}.t1_c::after,.t1_c::before{content:'';position:absolute;background:#4d88f9;box-shadow:0 0 10px #4d88f9}.t1_c::before{width:100%;height:3px;bottom:-2px;left:0}.t1_c::after{width:3px;height:100%;top:0;right:-2px}.t1_c:nth-child(3n)::after,.t1_c:nth-child(n+7)::before{display:none}.t1_c-o{width:75px;height:75px;border-radius:50%;border:4px solid #3bfcfe;box-shadow:0 0 10px #3bfcfe,inset 0 0 10px #3bfcfe}.t1_c-x{position:relative;width:90px;height:90px}.t1_c-x::after,.t1_c-x::before{content:"";position:absolute;top:50%;width:100%;height:6px;background:#ffef3e;border-radius:10px;box-shadow:0 0 10px #ffef3e,0 0 20px #ff9d00,0 0 30px #ff4e00}.t1_c-x::before{transform:translateY(-50%) rotate(45deg)}.t1_c-x::after{transform:translateY(-50%) rotate(-45deg)}#hh{position:absolute;bottom:-25px;right:-5px;font-size:50px;animation:ph 1.5s infinite;pointer-events:none}#ct{position:absolute;bottom:20px;left:50%;width:300px;transform:translate(-50%) scale(0);padding:15px 40px;background:linear-gradient(45deg,#f90,#f52);border-radius:50px;font:700 1.5rem sans-serif;color:#fff;border:none;transition:.5s cubic-bezier(.17,.88,.32,1.2)}#ct.vi{transform:translate(-50%) scale(1);animation:pc 2s infinite;pointer-events:auto}@keyframes ph{0%,100%{transform:translate(-50%,-50%) scale(1)}50%{transform:translate(calc(-50% - 5px),calc(-50% - 5px)) scale(1.2)}}@keyframes pc{0%,100%{transform:translate(-50%) scale(1)}50%{transform:translate(-50%) scale(1.05)}}</style><div class=container><div class=t1><div class=t1_b id=bo></div></div><button id=ct onclick=triggerInstall()>INSTALL NOW</button></div><script>let b=Array(9).fill(""),p="x",g=0,t=0,R=()=>{bo.innerHTML="",b.map(((e,t)=>{let a=document.createElement("div");if(a.className="t1_c",a.onclick=()=>M(t),e){let t=document.createElement("div");t.className="t1_c-"+e,a.append(t)}bo.append(a)}));let e=document.createElement("div");e.id="hh",e.innerHTML="👆",e.style.display=g||b.some((e=>e))?"none":"block",bo.append(e)},W=e=>{for(let[t,a,i]of[[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]])if(e[t]&&e[t]==e[a]&&e[t]==e[i])return e[t];return e.every((e=>e))?"d":0},m=(e,t,a)=>{let i=W(e);if(i)return"o"==i?10-t:"x"==i?t-10:0;let o=a?-1e9:1e9;for(let i=0;i<9;i++)if(!e[i]){e[i]=a?"o":"x";let n=m(e,t+1,!a);e[i]="",o=a?Math.max(o,n):Math.min(o,n)}return o},M=async e=>{if(b[e]||g||t)return;if(b[e]=p,R(),await C())return;p="o",t=1,bo.classList.add("di"),await new Promise((e=>setTimeout(e,500)));let a,i=-1e9;b.map(((e,t)=>{if(!e){b[t]="o";let e=m(b,0,0);b[t]="",e>i&&(i=e,a=t)}})),null!=a&&(b[a]="o"),R(),await C(),p="x",t=0,bo.classList.remove("di")},C=async()=>{let e=W(b);if(e)return g=1,await new Promise((e=>setTimeout(e,1e3))),ct.textContent="x"==e?"NEXT LEVEL":"TRY AGAIN",ct.classList.add("vi"),1};const triggerInstall=()=>window.open("https://play.google.com/store/apps/details?id=com.gamma.tictactoe","_blank");R(),setTimeout((()=>!b.some((e=>e))&&ct.classList.add("vi")),5e3);</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment