SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<title>12面骰·数字神断</title>
<style>
 body{font-family:Arial;text-align:center;background:#f5f5f5;padding-top:40px}
 #dice{font-size:80px;color:#333;margin:20px 0}
 button{padding:10px 25px;font-size:18px;border:none;background:#007bff;color:#fff;border-radius:5px;cursor:pointer}
 #result{max-width:400px;margin:20px auto;padding:15px;background:#fff;border-radius:8px;box-shadow:0 2px 6px rgba(0,0,0,.1)}
</style>
</head>
<body>
<h1>12 面骰 · 数字神断</h1>
<div id="dice"></div>
<button onclick="throwDice()">掷骰占卜</button>
<div id="result"></div>

<script>
// 工具:随机 1-12
const rnd = () => 1 + ~~(Math.random()*12);

// 生克绝判定
function relate(a,b){
  const s = {1:4,4:7,7:10,10:1, 2:5,5:8,8:11,11:2, 3:6,6:9,9:12,12:3};
  if(s[a]===b) return '生';
  if(s[b]===a) return '克';
  const j = ['1-8','2-6','3-5','4-10','7-11','12-7'];
  if(j.includes(`${a}-${b}`)||j.includes(`${b}-${a}`)) return '绝';
  return '平';
}

// 通关建议表
const tips = {
  '生':'吉象!可顺势而为,无需化解。',
  '克':'凶象!用“中间五行”通关:\n木克土→红色(火)\n土克水→金色(金)\n水克火→绿色(木)\n火克金→黄色(土)\n金克木→黑色(水)',
  '绝':'大凶!建议:\n① 当天穿“通关色”衣服\n② 避开数字相冲方位\n③ 可择吉时再行动',
  '平':'平象,保持常态即可。'
};

function throwDice(){
  const d = [rnd(),rnd(),rnd()];
  document.getElementById('dice').textContent = d.join(' · ');

  // 取首尾关系定大局(简单规则)
  const r = relate(d[0], d[2]);
  document.getElementById('result').innerHTML =
    `<b>${r.toUpperCase()}</b><br>${tips[r]}`;
}
</script>
</body>
</html>