{"id":939,"date":"2026-06-09T09:37:01","date_gmt":"2026-06-09T02:37:01","guid":{"rendered":"https:\/\/www.watyai.ac.th\/?p=939"},"modified":"2026-06-09T09:42:25","modified_gmt":"2026-06-09T02:42:25","slug":"%e0%b8%9b-5-%e0%b9%80%e0%b8%81%e0%b8%a1%e0%b8%8b%e0%b8%b9%e0%b9%82%e0%b8%94%e0%b8%81%e0%b8%b8","status":"publish","type":"post","link":"https:\/\/www.watyai.ac.th\/?p=939","title":{"rendered":"\u0e1b.5 \u0e40\u0e01\u0e21\u0e0b\u0e39\u0e42\u0e14\u0e01\u0e38"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"939\" class=\"elementor elementor-939\">\n\t\t\t\t<div class=\"elementor-element elementor-element-bbd447d e-flex e-con-boxed e-con e-parent\" data-id=\"bbd447d\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-fb135b9 elementor-widget elementor-widget-html\" data-id=\"fb135b9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<!DOCTYPE html>\r\n<html lang=\"th\">\r\n<head>\r\n<meta charset=\"utf-8\">\r\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\r\n<title>Sudoku Pro Enhanced<\/title>\r\n<style>\r\nbody{font-family:Arial,sans-serif;background:#f4f4f4;text-align:center;margin:0;padding:20px}\r\n#overlay,#summary{position:fixed;inset:0;background:rgba(0,0,0,.85);color:#fff;display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:999}\r\n.hidden{display:none!important}\r\nbutton{padding:12px 24px;font-size:18px;cursor:pointer}\r\n#board{display:grid;grid-template-columns:repeat(9,55px);width:max-content;margin:20px auto;border:3px solid #000}\r\n.cell{width:55px;height:55px;text-align:center;font-size:26px;border:1px solid #aaa;box-sizing:border-box}\r\n.fixed{background:#e5e5e5;font-weight:bold}\r\n.conflict{background:#ffcaca}\r\n#timer{font-size:24px;font-weight:bold}\r\n<\/style>\r\n<\/head>\r\n<body>\r\n\r\n<div id=\"overlay\">\r\n<h1>\ud83c\udfaf Sudoku Challenge<\/h1>\r\n<p>\u0e01\u0e14\u0e40\u0e23\u0e34\u0e48\u0e21\u0e40\u0e01\u0e21\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e40\u0e23\u0e34\u0e48\u0e21\u0e08\u0e31\u0e1a\u0e40\u0e27\u0e25\u0e32<\/p>\r\n<button onclick=\"startGame()\">\u0e40\u0e23\u0e34\u0e48\u0e21\u0e40\u0e01\u0e21<\/button>\r\n<\/div>\r\n\r\n<div id=\"summary\" class=\"hidden\">\r\n<h1>\ud83c\udfc6 \u0e40\u0e25\u0e48\u0e19\u0e2a\u0e33\u0e40\u0e23\u0e47\u0e08<\/h1>\r\n<h2 id=\"finalTime\"><\/h2>\r\n<p id=\"stats\"><\/p>\r\n<button onclick=\"location.reload()\">\u0e40\u0e25\u0e48\u0e19\u0e2d\u0e35\u0e01\u0e04\u0e23\u0e31\u0e49\u0e07<\/button>\r\n<\/div>\r\n\r\n<h2>Sudoku Pro<\/h2>\r\n<div id=\"timer\">00:00<\/div>\r\n<div id=\"board\"><\/div>\r\n\r\n<script>\r\nconst puzzle=[\r\n[0,7,0,0,4,0,0,3,1],\r\n[9,1,0,0,0,0,0,0,0],\r\n[0,0,0,0,7,0,2,8,0],\r\n[0,0,0,0,0,5,0,0,6],\r\n[1,0,5,0,0,0,3,0,0],\r\n[0,0,0,8,0,0,9,0,2],\r\n[0,0,1,0,3,6,0,0,0],\r\n[3,0,9,0,0,0,0,0,7],\r\n[4,0,0,5,0,1,0,2,0]\r\n];\r\n\r\nlet started=false;\r\nlet seconds=0;\r\nlet timerId=null;\r\nlet moves=0;\r\n\r\nconst board=document.getElementById(\"board\");\r\n\r\nfor(let r=0;r<9;r++){\r\n for(let c=0;c<9;c++){\r\n  const cell=document.createElement(\"input\");\r\n  cell.className=\"cell\";\r\n  cell.maxLength=1;\r\n  cell.dataset.r=r;\r\n  cell.dataset.c=c;\r\n\r\n  if(c===2||c===5) cell.style.borderRight=\"3px solid black\";\r\n  if(r===2||r===5) cell.style.borderBottom=\"3px solid black\";\r\n\r\n  if(puzzle[r][c]){\r\n    cell.value=puzzle[r][c];\r\n    cell.readOnly=true;\r\n    cell.classList.add(\"fixed\");\r\n  }\r\n\r\n  cell.addEventListener(\"input\",()=>{\r\n    cell.value=cell.value.replace(\/[^1-9]\/g,'');\r\n    moves++;\r\n    detectConflicts();\r\n    checkFinish();\r\n  });\r\n\r\n  board.appendChild(cell);\r\n }\r\n}\r\n\r\nfunction startGame(){\r\n started=true;\r\n document.getElementById(\"overlay\").classList.add(\"hidden\");\r\n timerId=setInterval(()=>{\r\n   seconds++;\r\n   const m=Math.floor(seconds\/60);\r\n   const s=seconds%60;\r\n   document.getElementById(\"timer\").textContent=\r\n   String(m).padStart(2,'0')+\":\"+String(s).padStart(2,'0');\r\n },1000);\r\n}\r\n\r\nfunction detectConflicts(){\r\n document.querySelectorAll('.cell').forEach(c=>c.classList.remove('conflict'));\r\n const cells=[...document.querySelectorAll('.cell')];\r\n\r\n function mark(group){\r\n  let seen={};\r\n  group.forEach(c=>{\r\n   if(!c.value) return;\r\n   if(seen[c.value]){\r\n     c.classList.add('conflict');\r\n     seen[c.value].classList.add('conflict');\r\n   }else seen[c.value]=c;\r\n  });\r\n }\r\n\r\n for(let i=0;i<9;i++){\r\n   mark(cells.filter(c=>+c.dataset.r===i));\r\n   mark(cells.filter(c=>+c.dataset.c===i));\r\n }\r\n\r\n for(let br=0;br<3;br++)\r\n for(let bc=0;bc<3;bc++)\r\n   mark(cells.filter(c=>\r\n      Math.floor(c.dataset.r\/3)==br &&\r\n      Math.floor(c.dataset.c\/3)==bc));\r\n}\r\n\r\nfunction checkFinish(){\r\n const cells=[...document.querySelectorAll('.cell')];\r\n const empty=cells.some(c=>c.value===\"\");\r\n const conflicts=document.querySelectorAll('.conflict').length;\r\n\r\n if(!empty && conflicts===0){\r\n   clearInterval(timerId);\r\n\r\n   document.getElementById(\"finalTime\").textContent =\r\n      \"\u0e40\u0e27\u0e25\u0e32 \"+document.getElementById(\"timer\").textContent;\r\n\r\n   document.getElementById(\"stats\").innerHTML =\r\n      \"\u0e08\u0e33\u0e19\u0e27\u0e19\u0e04\u0e23\u0e31\u0e49\u0e07\u0e17\u0e35\u0e48\u0e01\u0e23\u0e2d\u0e01\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25: <b>\"+moves+\"<\/b><br>\"+\r\n      \"\u0e2a\u0e16\u0e32\u0e19\u0e30: <b>\u0e2a\u0e33\u0e40\u0e23\u0e47\u0e08<\/b>\";\r\n\r\n   document.getElementById(\"summary\").classList.remove(\"hidden\");\r\n }\r\n}\r\n<\/script>\r\n<\/body>\r\n<\/html>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Sudoku Pro Enhanced \ud83c\udfaf Sudoku Challenge \u0e01\u0e14\u0e40\u0e23\u0e34\u0e48\u0e21\u0e40\u0e01\u0e21\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e40&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-939","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/www.watyai.ac.th\/index.php?rest_route=\/wp\/v2\/posts\/939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.watyai.ac.th\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.watyai.ac.th\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.watyai.ac.th\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.watyai.ac.th\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=939"}],"version-history":[{"count":4,"href":"https:\/\/www.watyai.ac.th\/index.php?rest_route=\/wp\/v2\/posts\/939\/revisions"}],"predecessor-version":[{"id":944,"href":"https:\/\/www.watyai.ac.th\/index.php?rest_route=\/wp\/v2\/posts\/939\/revisions\/944"}],"wp:attachment":[{"href":"https:\/\/www.watyai.ac.th\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.watyai.ac.th\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.watyai.ac.th\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}