PageSourceSearch

https://ttfdg.cn/tools/yu-gi-oh-probability-calculator/

html ttfdg.cn collected 2026-10-02 01:20:08 UTC 25,666 bytes, 431 lines download raw bytes

1<!DOCTYPE html>
2<html lang="zh-CN">
3
4<head>
5    <meta charset="UTF-8">
6    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7    <title>游戏王概率计算器 - 天天发蛋糕的工具箱</title>
8    <meta name="description" content="游戏王概率计算器 - 专业的卡组概率分析工具,支持自定义条件判断,精确计算启动率和上手率等概率。帮您优化卡组构筑。">
9    <meta name="keywords" content="游戏王, 概率计算, 卡组工具">
10    <link rel="stylesheet" href="../../assets/css/styles.css">
11    <link rel="stylesheet" href="../../assets/css/yu-gi-oh-probability-calculator.css">
12    <!-- Google tag (gtag.js) -->
vendor: 68 bytes, lines 12-13
12
13    <script async src="https://www.googletagmanager.com/gtag/js?id=
13G-HYJXFSRHF5
vendor: 16 bytes, lines 13-14
13"></script>
14    
14<script>
15        
vendor: 155 bytes, lines 15-19
15window.dataLayer = window.dataLayer || [];
16        function gtag() { dataLayer.push(arguments); }
17        gtag('js', new Date());
18
19        gtag('config', '
19G-HYJXFSRHF5
vendor: 8 bytes, lines 19-20
19');
20    
20</script>
20
21</head>
22
23<body>
24    <!-- 页头由 assets/js/site-chrome.js 统一注入 -->
25    <site-header></site-header>
26
27    <main class="container">
28        <h1>游戏王概率计算器</h1>
29
30        <div class="card card--elevated">
31            <!-- 卡组管理 -->
32            <div class="deck-management mb-1">
33                <div class="form-group">
34                    <label for="deckList">选择卡组</label>
35                    <select id="deckList" class="form-control">
36                        <option value="">-- 选择卡组 --</option>
37                    </select>
38                </div>
39                <div class="form-group">
40                    <label for="deckName">卡组名称</label>
41                    <input type="text" id="deckName" class="form-control" placeholder="输入卡组名称">
42                </div>
43                <div class="form-group deck-actions">
44                    <button onclick="saveDeck()" class="btn btn--success">保存</button>
45                    <button onclick="loadDeck()" class="btn btn--secondary">加载</button>
46                    <button onclick="deleteDeck()" class="btn btn--danger">删除</button>
47                </div>
48            </div>
49
50            <div class="main-content">
51                <!-- 卡牌输入 -->
52                <div class="card-input-section">
53                    <div class="flex align-center justify-space-between mb-2">
54                        <h2 class="mt-1 mb-0">卡牌输入</h2>
55                        <button id="importDeckBtn" type="button" class="btn btn--small btn--outline">导入卡组</button>
56                    </div>
57                    <div id="cardInputs" class="card-input-grid">
58                        <!-- 静态卡牌输入项,自动生成A-AZ共52项 -->
59                        
59<script>
60                            (function () {
61                                const labels = [];
62                                for (let i = 0; i < 52; i++) {
63                                    let label = '';
64                                    if (i < 26) label = String.fromCharCode(65 + i) + '类卡';
65                                    else label = 'A' + String.fromCharCode(65 + i - 26) + '类卡';
66                                    document.write(`
67                        <div class="form-group${i >= 26 ? ' hidden' : ''}">
68                            <label>${label}</label>
69                            <input type="number" id="card${i}" placeholder="数量" min="0" class="form-control card-count" onchange="updateTotalDeck()">
70                            <input type="text" id="cardName${i}" class="form-control mt-1" placeholder="卡名">
71                        </div>
72                                `);
73                                }
74                            })();
75                        </script>
75
76                        <!-- 显示更多/显示更少按钮 -->
77                        <div class="form-group flex flex--column gap-0">
78                            <label>显示更少</label>
79                            <button id="showLessCardsBtn" type="button"
80                                class="btn btn--outline full-width full-height">➖</button>
81                        </div>
82                        <div class="form-group flex flex--column gap-0">
83                            <label>显示更多</label>
84                            <button id="showMoreCardsBtn" type="button"
85                                class="btn btn--outline full-width full-height">➕</button>
86                        </div>
87                    </div>
88                </div>
89
90                <!-- 右侧区域 -->
91                <div class="right-section">
92                    <!-- 饼图容器 -->
93                    <div class="Pie-composition">
94                        <h2 class="mt-1 mb-2">卡组构成</h2>
95                        <div class="chart-section">
96                            <canvas id="deckPieChart"></canvas>
97                        </div>
98                    </div>
99
100                    <!-- 抽卡设置 -->
101                    <div class="draw-settings">
102                        <h2 class="mt-1 mb-2">抽卡设置</h2>
103                        <div class="draw-inputs">
104                            <div class="form-group">
105                                <label for="total">卡组总数</label>
106                                <input type="number" id="total" class="form-control" readonly>
107                            </div>
108                            <div class="form-group">
109                                <div class="flex gap-0 align-center">
110                                    <label for="draws">抽卡数</label>
111                                    <label for="autoIncrementDraws">
112                                        <input type="checkbox" id="autoIncrementDraws"> 计算后+
113                                    </label>
114                                    <input id="incrementValue" class="form-control" value="1" min="0">
115                                </div>
116                                <input type="number" id="draws" class="form-control" value="5" min="1">
117                            </div>
118                        </div>
119                    </div>
120                </div>
121            </div>
122
123            <!-- 新布局:左右分栏容器 -->
124            <div class="condition-results-container">
125                <div class="condition-column">
126                    <!-- 逻辑判断条件 -->
127                    <h2 class="mt-1 mb-2">逻辑判断条件</h2>
128                    <!-- 单选按钮组 -->
129                    <div class="condition-mode">
130                        <label>
131                            <input type="radio" name="conditionInputMode" value="manual" checked>
132                            手动输入
133                        </label>
134                        <label>
135                            <input type="radio" name="conditionInputMode" value="builder">
136                            条件构建器输入
137                        </label>
138                    </div>
139                    <div class="form-group" id="manualConditionInput">
140                        <textarea id="condition" rows="3" placeholder="输入逻辑判断条件,例如:
141a >= 1  // 至少抽到1张A类卡
142                        
143(a >= 1 || b >= 1) && c == 0  // 抽到A或B类卡且没有C类卡
144                        
145a + b >= 3  // A和B类卡合计至少3张
146                        
147灰流丽 >= 1 && 增殖的G >= 1 && 抹杀之指名者 == 0  // 使用自定的卡名来写表达式
148
149PROB(50) && a >= 1  // 50%概率满足条件且至少抽到1张A类卡
150
151a + b >= 3 && PROB(64.59)  // A和B类卡合计至少3张,与64.59%概率满足条件"></textarea>
152                    </div>
153                    <!-- 移动端输入说明 -->
154                    <div class="operator-help-mobile">
155                        <strong>输入说明:</strong><br>
156                        <strong>
156运算符(优先级从高到低):</strong>
157                        <code>()</code> - 明确运算优先级;<code>!</code> - 逻辑非;<code>*</code> - 乘;<code>/</code> -
158                        除;<code>%</code> -
159                        取模;<code>+</code> - 加;<code>-</code> - 减;
160                        <strong>比较运算符:</strong>
161                        <code>&gt;</code> - 大于;<code>&gt;=</code> - 大于等于;<code>&lt;</code> - 小于;<code>&lt;=</code> -
162                        小于等于;<code>==</code> - 等于;<code>!=</code> - 不等;<code>&&</code> - 逻辑与;<code>||</code> - 逻辑或;<br>
163                        <strong>变量名:</strong>
164                        <code>a</code>,<code>b</code>,<code>c</code>,...,<code>z</code>,<code>aa</code>,<code>ab</code>,...对应A类卡,B类卡,...,Z类卡,AA类卡,AB类卡,等等...。<br>
165                        <strong>自定义卡名:</strong>
166                        可以直接使用您输入的自定卡名作为变量名。计算器会帮您将自定卡名替换为对应的变量名,所以自定卡名建议避免使用容易混淆的名称(如纯英文字母、数字等)。建议使用纯中文名。<br>
167                        <strong>概率函数功能:</strong>
168                        <code>PROB(n)</code>表示n%的概率满足条件,n是0-100的任意数。此功能可以用来模拟一些具有概率性的卡片效果,例如:<br>
169                        - <code>PROB(50) && a >= 1</code> 表示:50%概率满足且至少1张A类卡<br>
170                        - <code>a + b >= 3 && PROB(34.68)</code> 表示:A+B类卡≥3张且34.68%概率满足<br>
171                        精度说明:n支持0-100的数值。精确计算时精度最高为小数点后两位(计算时自动四舍五入),多个高精度的<code>PROB(n)</code>合并判断会导致精确计算时长指数级上升。快速估算时会使用实际输入的百分比进行计算。<br>
172                        <strong>注意事项:</strong>
173                        在条件表达式中,<code>=</code>是赋值运算符。如果您要判断相等,请使用<code>==</code>或<code>===</code>。注意不要使用中文标点符号来书写运算符(例如中文括号)。<br>
174                        - 当卡种类和抽卡数较高时,计算时间会呈指数级上升,此时推荐使用快速估算。
175                    </div>
176                    <!-- 条件构建器区域 -->
177                    <div id="builderConditionInput" class="form-group hidden">
178                        <div id="conditionBuilder"></div>
179                        <!-- 新增:实时显示构建器生成的条件表达式 -->
180                        <label class="mt-1 mb-1" for="builderConditionPreview"><strong>生成的逻辑判断条件:</strong></label>
181                        <textarea id="builderConditionPreview" rows="2" readonly></textarea>
182                    </div>
183                </div>
184                <div class="calculation-column">
185                    <h2 class="mt-1 mb-2">计算操作</h2>
186                    <!-- 计算按钮组 -->
187                    <div class="calculation-actions mt-2 mb-2">
188                        <button onclick="calculate()" class="btn btn--primary">精确计算</button>
189                        <button onclick="monteCarloCalculate()" class="btn btn--secondary">快速估算</button>
190                        <button onclick="cancelCalculation()" id="cancelBtn"
191                            class="btn btn--danger hidden">取消计算</button>
192                    </div>
193                    <div class="calculation-actions mt-2 mb-2">
194                        <button onclick="exportCalculationRecords()" class="btn btn--outline">导出记录</button>
195                        <button onclick="clearCalculationRecords()" class="btn btn--danger">删除记录</button>
196                    </div>
197                    <!-- 进度条 -->
198                    <div id="progressContainer" class="progress-container">
199                        <div class="form-group">
200                            <label>计算进度</label>
201                            <progress id="calculationProgress" value="
2010" max="100"></progress>
202                            <div id="progressText" class="text-center">等待计算...</div>
203                        </div>
204                    </div>
205                    <!-- 结果输出 -->
206                    <div class="result-section">
207                        <h2 class="mt-1 mb-2">计算结果</h2>
208                        <div class="result-grid grid">
209                            <div class="form-group">
210                                <label for="probability">概率</label>
211                                <input type="text" id="probability" class="form-control" readonly>
212                            </div>
213                            <div class="form-group">
214                                <label for="validCombinations">满足条件组合数</label>
215                                <input type="text" id="validCombinations" class="form-control" readonly>
216                            </div>
217                            <div class="form-group">
218                                <label for="totalCombinations">总组合数</label>
219                                <input type="text" id="totalCombinations" class="form-control" readonly>
220                            </div>
221                        </div>
222                    </div>
223                </div>
224            </div>
225            <!-- 新增:桌面端输入说明,显示在条件与计算操作/结果下面 -->
226            <div class="operator-help-desktop">
227                <strong>输入说明:</strong><br>
228                <strong>运算符(优先级从高到低):</strong>
229                <code>()</code> - 明确运算优先级;<code>!</code> - 逻辑非;<code>*</code> - 乘;<code>/</code> - 除;<code>%</code> -
230                取模;<code>+</code> - 加;<code>-</code> - 减;
231                <strong>比较运算符:</strong>
232                <code>&gt;</code> - 大于;<code>&gt;=</code> - 大于等于;<code>&lt;</code> - 小于;<code>&lt;=</code> -
233                小于等于;<code>==</code> - 等于;<code>!=</code> - 不等;<code>&&</code> - 逻辑与;<code>||</code> - 逻辑或;<br>
234                <strong>变量名:</strong>
235                <code>a</code>,<code>b</code>,<code>c</code>,...,<code>z</code>,<code>aa</code>,<code>ab</code>,...对应A类卡,B类卡,...,Z类卡,AA类卡,AB类卡,等等...。<br>
236                <strong>自定义卡名:</strong>
237                可以直接使用您输入的自定卡名作为变量名。计算器会帮您将自定卡名替换为对应的变量名,所以自定卡名建议避免使用容易混淆的名称(如纯英文字母、数字等)。建议使用纯中文名。<br>
238                <strong>概率函数功能:</strong>
239                <code>PROB(n)</code>表示n%的概率满足条件,n是0-100的任意数。此功能可以用来模拟一些具有概率性的卡片效果,例如:<br>
240                - <code>PROB(50) && a >= 1</code> 表示:50%概率满足且至少1张A类卡<br>
241                - <code>a + b >= 3 && PROB(34.68)</code> 表示:A+B类卡≥3张且34.68%概率满足<br>
242                精度说明:n支持0-100的数值。精确计算时精度最高为小数点后两位(计算时自动四舍五入),多个高精度的<code>PROB(n)</code>合并判断会导致精确计算时长指数级上升。快速估算时会使用实际输入的百分比进行计算。<br>
243                <strong>注意事项:</strong>
244                在条件表达式中,<code>=</code>是赋值运算符。如果您要判断相等,请使用<code>==</code>或<code>===</code>。注意不要使用中文标点符号来书写运算符(例如中文括号)。<br>
245                - 当卡种类和抽卡数较高时,计算时间会呈指数级上升,此时推荐使用快速估算。
246            </div>
247            <div class="source-info mb-1 mt-6">
248                <div>
249                    该工具部分代码与思路来源于<a href="https://tieba.baidu.com/home/main?id=tb.1.700dbce0.kfzKa-FBDB-cm-gMSey3Yw"
250                        target="_blank">@jyhyqw</a>在贴吧<a href="https://tieba.baidu.com/p/5516965391"
251                        target="_blank">上位卡组吧发帖</a>发布的<a href="概率计算器改.zip"
252                        target="_blank">游戏王概率计算器</a>。条件构建器的实现参考了x6ud的<a href="https://gitee.com/x6ud/ygo-draw-simulator"
253                        target="_blank">游戏王上手率测试器</a>。<br>
254                </div>
255                <div>卡片数据由百鸽(ygocdb.com)API提供,特此感谢。<br></div>
256                <div>下载使用本工具的<a
257                        href="../../tools/yu-gi-oh-probability-calculator/游戏王概率计算器 - 本地版 - 2026-01-15.zip">本地版</a>。
258                </div>
259                <div><a href="https://www.bilibili.com/video/BV1Gqjpz5Eyp/">教程视频</a>。
260                </div>
261            </div>
262        </div>
263
264        <!-- 计算历史记录区域 -->
265        <div class="card card--elevated hidden" id="historyTable">
266            <div class="history-container">
267                <!-- 概率折线图 -->
268                <div class="history-chart">
269                    <h2 class="mt-1 mb-2">历史概率变化</h2>
270                    <div class="history-chart-section">
271                        <canvas id="historyLineChart"></canvas>
272                    </div>
273                </div>
274            </div>
275        </div>
276
277        <!-- 计算历史记录控制按钮 -->
278        <div class="form-group flex flex--column gap-0">
279            <button id="showHistoryBtn" type="button" class="btn btn--outline full-width full-height">显示历史记录</button>
280            <button id="hideHistoryBtn" type="button"
281                class="btn btn--outline full-width full-height hidden">隐藏历史记录</button>
282        </div>
283
284        <!-- 工具卡片区域 -->
285        <div class="grid grid-2 mt-5">
286            <div class="card card--elevated">
287                <div class="flex--column flex full-height">
288                    <h2 class="mt-0">概率对抗计算器</h2>
289                    <div>
290                        <div>
291                            <label for="positiveProb">正方成功率(%)</label>
292                            <input type="number" id="positiveProb" class="" min="0" max="100" step="0.1"
293                                placeholder="输入正方成功率">
294                        </div>
295                        <div>
296                            <label for="negativeProb">反方成功率(%)</label>
297                            <input type="number" id="negativeProb" class="" min="0" max="100" step="0.1"
298                                placeholder="输入反方成功率">
299                        </div>
300                    </div>
301                    <div>
302                        <div class="probability-grid">
303                            <div class="probability probability-header">并且</div>
304                            <div class="probability probability-header">正方成功</div>
305                            <div class="probability probability-header">正方失败</div>
306
307                            <div class="probability probability-header">反方成功</div>
308                            <div class="probability probability-cell" id="bothSuccess">0%</div>
309                            <div class="probability probability-cell" id="negativeSuccess">0%</div>
310
311                            <div class="probability probability-header">反方失败</div>
312                            <div class="probability probability-cell" id="positiveSuccess">0%</div>
313                            <div class="probability probability-cell" id="bothFail">0%</div>
314                        </div>
315                    </div>
316                </div>
317            </div>
318            <div class="card card--elevated">
319                <div class="flex--column flex full-height">
320                    <h2 class="mt-0">实际组合生成器</h2>
321                    <div class="flex flex--column">
322                        <div class="condition-mode">
323                            <label>
324                                <input type="radio" name="combinationType" value="valid" checked>
325                                符合条件的组合
326                            </label>
327                            <label>
328                                <input type="radio" name="combinationType" value="invalid">
329                                不符合条件的组合
330                            </label>
331                        </div>
332                        <div class="condition-mode">
333                            <label for="combinationCount">生成数量</label>
334                            <input type="number" id="combinationCount" class="form-control auto-width" min="1"
335                                value="10">
336                        </div>
337                        <button class="btn btn--primary" onclick="generateCombinations()">生成组合</button>
338                    </div>
339                    <div class="form-group">
340                        <label for="combinationResults">结果</label>
341                        <textarea id="combinationResults" class="form-control" rows="8" readonly></textarea>
342                    </div>
343                </div>
344            </div>
345            </div>
346    </main>
347
348    <!-- 页脚由 assets/js/site-chrome.js 统一注入 -->
349    <site-footer></site-footer>
350
351    <!-- 导入卡组模态窗口 -->
352    <div id="importDeckModal" class="modal hidden">
353        <div class="modal-content">
354            <div class="modal-header">
355                <h3 class="modal-title">导入卡组</h3>
356                <button type="button" class="modal-close" id="closeImportModalBtn">&times;</button>
357            </div>
358            <div class="modal-body">
359                <div class="form-group">
360                    <label>导入方式</label>
361                    <div class="condition-mode">
362                        <label>
363                            <input type="radio" name="importMethod" value="file" checked>
364                            选择.ydk文件
365                        </label>
366                        <label>
367                            <input type="radio" name="importMethod" value="text">
368                            输入ydk文本
369                        </label>
370                    </div>
371                </div>
372
373                <div id="fileImportSection" class="import-section">
374                    <div class="form-group">
375                        <label for="ydkFile">选择.ydk文件</label>
376                        <input type="file" id="ydkFile" accept=".ydk" class="form-control">
377                    </div>
378                    <div class="form-group">
379                        <label for="filePreview">文件预览</label>
380                        <textarea id="filePreview" class="form-control" rows="5" readonly
381                            placeholder="选择文件后显示内容..."></textarea>
382                    </div>
383                </div>
384
385                <div id="textImportSection" class="import-section hidden">
386                    <div class="form-group">
387                        <label for="ydkText">输入.ydk格式文本</label>
388                        <textarea id="ydkText" class="form-control" rows="10" placeholder="粘贴.ydk文件内容,例如:
389#main
39028306253
39165681983
39245171524
393..."></textarea>
394                    </div>
395                </div>
396
397                <div class="form-group">
398                    <label for="importStatus">导入状态</label>
399                    <textarea id="importStatus" class="form-control" rows="3" readonly placeholder="等待导入..."></textarea>
400                </div>
401            </div>
402            <div class="modal-footer">
403                <button type="button" class="btn btn--secondary" id="cancelImportBtn">取消</button>
404                <button type="button" class="btn btn--primary" id="importBtn">导入</button>
405            </div>
406        </div>
407    </div>
408
409    <!-- 游戏王概率计算器子模块 -->
410    <!-- Chart.js 改为同步加载(位于业务脚本之前),避免 async 竞态导致 Chart is not defined -->
411    
411<script src="../../assets/js/chart.umd.min.js"></script>
411
412    
412<script src="../../assets/js/ui-utils.js"></script>
412
413    
413<script src="../../assets/js/data-manager.js"></script>
413
414    
414<script src="../../assets/js/condition-builder.js"></script>
414
415    
415<script src="../../assets/js/calculation-engine.js"></script>
415
416    
416<script src="../../assets/js/probability-adversary-calculator.js"></script>
416
417    <!-- 卡组导入模块 -->
418    
418<script src="../../assets/js/deck-importer.js"></script>
418
419    <!-- 游戏王概率计算器主模块 -->
420    
420<script src="../../assets/js/yu-gi-oh-probability-calculator.js"></script>
420
421
422    <!-- 实际组合生成器 -->
423    
423<script src="../../assets/js/combination-generator.js"></script>
423
424
425    <!-- 站点共享页头/页脚注入 -->
426    
426<script src="../../assets/js/site-chrome.js"></script>
426
427
428<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v31edd6df95cf4e85bb4c19e7a9bdbcba1788362987495" integrity="sha512-iIg7k2xntmwu6/uSb5tpc/hySgZc4eoL31yB29W6tJFo2akwjPWcEqnCEdJvGexCL0KEQwVYv5BlowfhVz26hg==" data-cf-beacon='{"version":"2024.11.0","token":"853ec85d76f94cf48e60241243558d48","r":1,"spa":2}' crossorigin="anonymous"></script>
428
429</body>
430
431</html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.