SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D杀码四码计算器 增强版</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: system-ui, sans-serif;
        }
        body {
            padding: 16px;
            background-color: #f4f5f7;
        }
        .container {
            max-width: 480px;
            margin: 0 auto;
            background: #fff;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 2px 10px #00000018;
        }
        h2 {
            text-align: center;
            margin-bottom:16px;
            color:#222;
        }
        .tab-wrap{
            display:flex;
            gap:6px;
            margin-bottom:18px;
        }
        .tab{
            flex:1;
            padding:10px;
            text-align:center;
            border-radius:8px;
            background:#e5e7eb;
            cursor:pointer;
            font-weight:500;
        }
        .tab.active{
            background:#2563eb;
            color:#fff;
        }
        .panel{display:none;}
        .panel.show{display:block;}
        .input-row{
            margin-bottom:16px;
        }
        label{
            display:block;
            margin-bottom:8px;
            font-weight:500;
        }
        input, textarea{
            width:100%;
            padding:12px;
            font-size:16px;
            border:1px solid #ddd;
            border-radius:8px;
        }
        textarea{
            min-height:180px;
            resize:vertical;
        }
        button{
            width:100%;
            padding:13px;
            border:none;
            background:#2563eb;
            color:white;
            font-size:17px;
            border-radius:8px;
            cursor:pointer;
            margin-top:6px;
        }
        button:active{
            background:#1d4ed8;
        }
        .btn-gray{
            background:#6b7280;
        }
        .btn-green{
            background:#16a34a;
        }
        .result{
            margin-top:16px;
            padding:14px;
            background:#f0f7ff;
            border-radius:8px;
            font-size:16px;
            line-height:1.7;
            white-space:pre-wrap;
        }
        .stat{
            margin-top:12px;
            padding:12px;
            background:#ecfdf5;
            border-radius:8px;
            font-size:15px;
            line-height:1.6;
        }
        .tip{
            margin-top:14px;
            color:#666;
            font-size:13px;
        }
        .record-item{
            padding:10px;
            border-bottom:1px solid #eee;
            font-size:15px;
            display:flex;
            justify-content:space-between;
            align-items:center;
        }
        .del-btn{
            padding:4px 8px;
            font-size:13px;
            background:#dc2626;
            color:#fff;
            border:none;
            border-radius:4px;
            margin-top:0;
            width:auto;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>3D杀码四码计算器</h2>
        <div class="tab-wrap">
            <div class="tab active" data-tab="single">单期计算</div>
            <div class="tab" data-tab="batch">批量回测</div>
            <div class="tab" data-tab="history">历史记录</div>
        </div>

        <!-- 单期计算 -->
        <div class="panel show" id="single">
            <div class="input-row">
                <label>输入上期3位开奖号</label>
                <input type="text" id="numInput" maxlength="3" placeholder="例如:287">
            </div>
            <button onclick="calcSingle()">开始计算</button>
            <div class="result" id="singleResult"></div>
        </div>

        <!-- 批量回测 -->
        <div class="panel" id="batch">
            <div class="input-row">
                <label>每行格式:上期→下期 (例:791→666)</label>
                <textarea id="batchInput" placeholder="954→777
777→092
092→034"></textarea>
            </div>
            <button onclick="runBatch()">开始回测</button>
            <button class="btn-green" onclick="saveBatchResult()">保存本次回测结果到历史记录</button>
            <div class="result" id="batchResult"></div>
            <div class="stat" id="batchStat"></div>
        </div>

        <!-- 历史记录 -->
        <div class="panel" id="history">
            <div id="historyList"></div>
            <button class="btn-gray" onclick="clearHistory()">清空全部记录</button>
        </div>

        <div class="tip">⚠️仅历史回测娱乐参考,彩票开奖随机,请理性购彩</div>
    </div>

<script>
    // 切换标签
    const tabs = document.querySelectorAll('.tab');
    tabs.forEach(tab=>{
        tab.onclick = ()=>{
            tabs.forEach(t=>t.classList.remove('active'));
            document.querySelectorAll('.panel').forEach(p=>p.classList.remove('show'));
            tab.classList.add('active');
            const id = tab.dataset.tab;
            document.getElementById(id).classList.add('show');
            if(id === 'history') renderHistory();
        }
    })

    // 核心计算函数
    function coreCalc(inputNum){
        const a = inputNum[0];
        const b = inputNum[1];
        const c = inputNum[2];
        // 十位个位交换
        const swapped = a + c + b;
        const p1 = parseInt(swapped[0]);
        const p2 = parseInt(swapped[1]);

        //生成去重序列
        let seq = [p1,p2];
        for(let i=0;i<10;i++){
            if(!seq.includes(i)){
                seq.push(i);
            }
        }
        //基准序号映射 1,2,3,4,5,6,7,8,9,0
        const base_order = [1,2,3,4,5,6,7,8,9,0];
        let mapping = {};
        for(let idx=0;idx<10;idx++){
            mapping[base_order[idx]] = seq[idx];
        }
        //模板
        const templates = [[1,2,8,0],[1,2,4,6],[3,5,7,9]];
        let fourCodeList = [];
        for(let tpl of templates){
            let str = "";
            for(let n of tpl){
                str += mapping[n];
            }
            fourCodeList.push(str);
        }
        //十位等差杀三码
        const ten = parseInt(b);
        const s1 = (ten -5 +10)%10;
        const s2 = (ten -3 +10)%10;
        const s3 = ten%10;
        const kill3 = `${s1}${s2}${s3}`;
        return {kill3, fourCodeList};
    }

    // ========== 历史记录模块 ==========
    function getHistory(){
        return JSON.parse(localStorage.getItem('codeHistory') || '[]');
    }
    function saveHistory(text){
        let arr = getHistory();
        const time = new Date().toLocaleString();
        arr.unshift({time:time, content:text});
        if(arr.length>200) arr.pop();
        localStorage.setItem('codeHistory', JSON.stringify(arr));
    }
    function renderHistory(){
        const list = getHistory();
        const box = document.getElementById('historyList');
        if(list.length===0){
            box.innerHTML = "<div style='color:#888;padding:10px'>暂无历史记录</div>";
            return;
        }
        box.innerHTML = list.map((item,idx)=>`
            <div class="record-item">
                <div>【${item.time}】<br>${item.content}</div>
                <button class="del-btn" onclick="delRecord(${idx})">删除</button>
            </div>
        `).join('');
    }
    function delRecord(index){
        let arr = getHistory();
        arr.splice(index,1);
        localStorage.setItem('codeHistory', JSON.stringify(arr));
        renderHistory();
    }
    function clearHistory(){
        localStorage.removeItem('codeHistory');
        renderHistory();
    }

    // 单期计算
    function calcSingle(){
        const input = document.getElementById("numInput").value.trim();
        const resultBox = document.getElementById("singleResult");
        if(!/^\d{3}$/.test(input)){
            resultBox.innerHTML = "❌请输入3位纯数字号码";
            return;
        }
        const res = coreCalc(input);
        const outText =
`上期${input}
十位等差杀三码:${res.kill3}=01
三组四码(4=12):${res.fourCodeList[0]}、${res.fourCodeList[1]}、${res.fourCodeList[2]}`;
        resultBox.innerHTML = outText;
        saveHistory(outText);
    }

    // 批量回测
    let lastBatchResult = "";
    function runBatch(){
        const raw = document.getElementById("batchInput").value.trim();
        const resBox = document.getElementById("batchResult");
        const statBox = document.getElementById("batchStat");
        if(!raw){
            resBox.innerHTML = "❌请粘贴回测数据";
            return;
        }
        const lines = raw.split(/\n+/).filter(l=>l.trim());
        let killOk=0, killErr=0;
        let aOk=0,aErr=0;
        let bOk=0,bErr=0;
        let cOk=0,cErr=0;
        let output = "";

        for(const line of lines){
            const parts = line.split(/[→\-\s]+/);
            if(parts.length<2) continue;
            const prev = parts[0].trim();
            const next = parts[1].trim();
            if(!/^\d{3}$/.test(prev) || !/^\d{3}$/.test(next)) continue;
            const calc = coreCalc(prev);
            const killSet = calc.kill3.split('').map(Number);
            const nextDigits = next.split('').map(Number);
            // 杀三码=01:命中0个或者1个 ✅,>=2 ❌
            const killHit = nextDigits.filter(d=>killSet.includes(d)).length;
            const killMark = (killHit<=1) ? "✅" : "❌";
            if(killMark==="✅") killOk++; else killErr++;

            // 每组四码 4=12:命中1或2个 ✅,0或3个 ❌
            function checkFour(code){
                const set = code.split('').map(Number);
                const hit = nextDigits.filter(d=>set.includes(d)).length;
                return (hit===1||hit===2) ? "✅" : "❌";
            }
            const markA = checkFour(calc.fourCodeList[0]);
            const markB = checkFour(calc.fourCodeList[1]);
            const markC = checkFour(calc.fourCodeList[2]);
            if(markA==="✅") aOk++; else aErr++;
            if(markB==="✅") bOk++; else bErr++;
            if(markC==="✅") cOk++; else cErr++;

            output += `上期${prev} → 下期${next}\n杀三码:${calc.kill3} ${killMark} | 四码1:${calc.fourCodeList[0]} ${markA} | 四码2:${calc.fourCodeList[1]} ${markB} | 四码3:${calc.fourCodeList[2]} ${markC}\n\n`;
        }
        const total = killOk+killErr;
        const statText =
`总期数:${total}
杀三码:正确${killOk} 错误${killErr} 命中率${(killOk/total*100).toFixed(1)}%
第一组四码:正确${aOk} 错误${aErr} 命中率${(aOk/total*100).toFixed(1)}%
第二组四码:正确${bOk} 错误${bErr} 命中率${(bOk/total*100).toFixed(1)}%
第三组四码:正确${cOk} 错误${cErr} 命中率${(cOk/total*100).toFixed(1)}%`;

        resBox.innerHTML = output;
        statBox.innerHTML = statText;
        lastBatchResult = output + "\n" + statText;
    }
    // 保存批量回测结果
    function saveBatchResult(){
        if(!lastBatchResult){
            alert("请先执行批量回测!");
            return;
        }
        saveHistory("【批量回测】\n"+lastBatchResult);
        alert("✅ 已保存到历史记录!");
    }
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D杀码四码计算器 增强版</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: system-ui, sans-serif;
        }
        body {
            padding: 16px;
            background-color: #f4f5f7;
        }
        .container {
            max-width: 480px;
            margin: 0 auto;
            background: #fff;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 2px 10px #00000018;
        }
        h2 {
            text-align: center;
            margin-bottom:16px;
            color:#222;
        }
        .tab-wrap{
            display:flex;
            gap:6px;
            margin-bottom:18px;
        }
        .tab{
            flex:1;
            padding:10px;
            text-align:center;
            border-radius:8px;
            background:#e5e7eb;
            cursor:pointer;
            font-weight:500;
        }
        .tab.active{
            background:#2563eb;
            color:#fff;
        }
        .panel{display:none;}
        .panel.show{display:block;}
        .input-row{
            margin-bottom:16px;
        }
        label{
            display:block;
            margin-bottom:8px;
            font-weight:500;
        }
        input, textarea{
            width:100%;
            padding:12px;
            font-size:16px;
            border:1px solid #ddd;
            border-radius:8px;
        }
        textarea{
            min-height:180px;
            resize:vertical;
        }
        button{
            width:100%;
            padding:13px;
            border:none;
            background:#2563eb;
            color:white;
            font-size:17px;
            border-radius:8px;
            cursor:pointer;
            margin-top:6px;
        }
        button:active{
            background:#1d4ed8;
        }
        .btn-gray{
            background:#6b7280;
        }
        .btn-green{
            background:#16a34a;
        }
        .result{
            margin-top:16px;
            padding:14px;
            background:#f0f7ff;
            border-radius:8px;
            font-size:16px;
            line-height:1.7;
            white-space:pre-wrap;
        }
        .stat{
            margin-top:12px;
            padding:12px;
            background:#ecfdf5;
            border-radius:8px;
            font-size:15px;
            line-height:1.6;
        }
        .tip{
            margin-top:14px;
            color:#666;
            font-size:13px;
        }
        .record-item{
            padding:10px;
            border-bottom:1px solid #eee;
            font-size:15px;
            display:flex;
            justify-content:space-between;
            align-items:center;
        }
        .del-btn{
            padding:4px 8px;
            font-size:13px;
            background:#dc2626;
            color:#fff;
            border:none;
            border-radius:4px;
            margin-top:0;
            width:auto;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>3D杀码四码计算器</h2>
        <div class="tab-wrap">
            <div class="tab active" data-tab="single">单期计算</div>
            <div class="tab" data-tab="batch">批量回测</div>
            <div class="tab" data-tab="history">历史记录</div>
        </div>

        <!-- 单期计算 -->
        <div class="panel show" id="single">
            <div class="input-row">
                <label>输入上期3位开奖号</label>
                <input type="text" id="numInput" maxlength="3" placeholder="例如:287">
            </div>
            <button onclick="calcSingle()">开始计算</button>
            <div class="result" id="singleResult"></div>
        </div>

        <!-- 批量回测 -->
        <div class="panel" id="batch">
            <div class="input-row">
                <label>每行格式:上期→下期 (例:791→666)</label>
                <textarea id="batchInput" placeholder="954→777
777→092
092→034"></textarea>
            </div>
            <button onclick="runBatch()">开始回测</button>
            <button class="btn-green" onclick="saveBatchResult()">保存本次回测结果到历史记录</button>
            <div class="result" id="batchResult"></div>
            <div class="stat" id="batchStat"></div>
        </div>

        <!-- 历史记录 -->
        <div class="panel" id="history">
            <div id="historyList"></div>
            <button class="btn-gray" onclick="clearHistory()">清空全部记录</button>
        </div>

        <div class="tip">⚠️仅历史回测娱乐参考,彩票开奖随机,请理性购彩</div>
    </div>

<script>
    // 切换标签
    const tabs = document.querySelectorAll('.tab');
    tabs.forEach(tab=>{
        tab.onclick = ()=>{
            tabs.forEach(t=>t.classList.remove('active'));
            document.querySelectorAll('.panel').forEach(p=>p.classList.remove('show'));
            tab.classList.add('active');
            const id = tab.dataset.tab;
            document.getElementById(id).classList.add('show');
            if(id === 'history') renderHistory();
        }
    })

    // 核心计算函数
    function coreCalc(inputNum){
        const a = inputNum[0];
        const b = inputNum[1];
        const c = inputNum[2];
        // 十位个位交换
        const swapped = a + c + b;
        const p1 = parseInt(swapped[0]);
        const p2 = parseInt(swapped[1]);

        //生成去重序列
        let seq = [p1,p2];
        for(let i=0;i<10;i++){
            if(!seq.includes(i)){
                seq.push(i);
            }
        }
        //基准序号映射 1,2,3,4,5,6,7,8,9,0
        const base_order = [1,2,3,4,5,6,7,8,9,0];
        let mapping = {};
        for(let idx=0;idx<10;idx++){
            mapping[base_order[idx]] = seq[idx];
        }
        //模板
        const templates = [[1,2,8,0],[1,2,4,6],[3,5,7,9]];
        let fourCodeList = [];
        for(let tpl of templates){
            let str = "";
            for(let n of tpl){
                str += mapping[n];
            }
            fourCodeList.push(str);
        }
        //十位等差杀三码
        const ten = parseInt(b);
        const s1 = (ten -5 +10)%10;
        const s2 = (ten -3 +10)%10;
        const s3 = ten%10;
        const kill3 = `${s1}${s2}${s3}`;
        return {kill3, fourCodeList};
    }

    // ========== 历史记录模块 ==========
    function getHistory(){
        return JSON.parse(localStorage.getItem('codeHistory') || '[]');
    }
    function saveHistory(text){
        let arr = getHistory();
        const time = new Date().toLocaleString();
        arr.unshift({time:time, content:text});
        if(arr.length>200) arr.pop();
        localStorage.setItem('codeHistory', JSON.stringify(arr));
    }
    function renderHistory(){
        const list = getHistory();
        const box = document.getElementById('historyList');
        if(list.length===0){
            box.innerHTML = "<div style='color:#888;padding:10px'>暂无历史记录</div>";
            return;
        }
        box.innerHTML = list.map((item,idx)=>`
            <div class="record-item">
                <div>【${item.time}】<br>${item.content}</div>
                <button class="del-btn" onclick="delRecord(${idx})">删除</button>
            </div>
        `).join('');
    }
    function delRecord(index){
        let arr = getHistory();
        arr.splice(index,1);
        localStorage.setItem('codeHistory', JSON.stringify(arr));
        renderHistory();
    }
    function clearHistory(){
        localStorage.removeItem('codeHistory');
        renderHistory();
    }

    // 单期计算
    function calcSingle(){
        const input = document.getElementById("numInput").value.trim();
        const resultBox = document.getElementById("singleResult");
        if(!/^\d{3}$/.test(input)){
            resultBox.innerHTML = "❌请输入3位纯数字号码";
            return;
        }
        const res = coreCalc(input);
        const outText =
`上期${input}
十位等差杀三码:${res.kill3}=01
三组四码(4=12):${res.fourCodeList[0]}、${res.fourCodeList[1]}、${res.fourCodeList[2]}`;
        resultBox.innerHTML = outText;
        saveHistory(outText);
    }

    // 批量回测
    let lastBatchResult = "";
    function runBatch(){
        const raw = document.getElementById("batchInput").value.trim();
        const resBox = document.getElementById("batchResult");
        const statBox = document.getElementById("batchStat");
        if(!raw){
            resBox.innerHTML = "❌请粘贴回测数据";
            return;
        }
        const lines = raw.split(/\n+/).filter(l=>l.trim());
        let killOk=0, killErr=0;
        let aOk=0,aErr=0;
        let bOk=0,bErr=0;
        let cOk=0,cErr=0;
        let output = "";

        for(const line of lines){
            const parts = line.split(/[→\-\s]+/);
            if(parts.length<2) continue;
            const prev = parts[0].trim();
            const next = parts[1].trim();
            if(!/^\d{3}$/.test(prev) || !/^\d{3}$/.test(next)) continue;
            const calc = coreCalc(prev);
            const killSet = calc.kill3.split('').map(Number);
            const nextDigits = next.split('').map(Number);
            // 杀三码=01:命中0个或者1个 ✅,>=2 ❌
            const killHit = nextDigits.filter(d=>killSet.includes(d)).length;
            const killMark = (killHit<=1) ? "✅" : "❌";
            if(killMark==="✅") killOk++; else killErr++;

            // 每组四码 4=12:命中1或2个 ✅,0或3个 ❌
            function checkFour(code){
                const set = code.split('').map(Number);
                const hit = nextDigits.filter(d=>set.includes(d)).length;
                return (hit===1||hit===2) ? "✅" : "❌";
            }
            const markA = checkFour(calc.fourCodeList[0]);
            const markB = checkFour(calc.fourCodeList[1]);
            const markC = checkFour(calc.fourCodeList[2]);
            if(markA==="✅") aOk++; else aErr++;
            if(markB==="✅") bOk++; else bErr++;
            if(markC==="✅") cOk++; else cErr++;

            output += `上期${prev} → 下期${next}\n杀三码:${calc.kill3} ${killMark} | 四码1:${calc.fourCodeList[0]} ${markA} | 四码2:${calc.fourCodeList[1]} ${markB} | 四码3:${calc.fourCodeList[2]} ${markC}\n\n`;
        }
        const total = killOk+killErr;
        const statText =
`总期数:${total}
杀三码:正确${killOk} 错误${killErr} 命中率${(killOk/total*100).toFixed(1)}%
第一组四码:正确${aOk} 错误${aErr} 命中率${(aOk/total*100).toFixed(1)}%
第二组四码:正确${bOk} 错误${bErr} 命中率${(bOk/total*100).toFixed(1)}%
第三组四码:正确${cOk} 错误${cErr} 命中率${(cOk/total*100).toFixed(1)}%`;

        resBox.innerHTML = output;
        statBox.innerHTML = statText;
        lastBatchResult = output + "\n" + statText;
    }
    // 保存批量回测结果
    function saveBatchResult(){
        if(!lastBatchResult){
            alert("请先执行批量回测!");
            return;
        }
        saveHistory("【批量回测】\n"+lastBatchResult);
        alert("✅ 已保存到历史记录!");
    }
</script>
</body>
</html>