[色子游戏]奖励配置-新增按规则自动生成奖励配置

This commit is contained in:
2026-03-25 13:42:46 +08:00
parent bd402aa97d
commit 5ef8ee8bc5
5 changed files with 1069 additions and 4 deletions

View File

@@ -0,0 +1,53 @@
/**
* 命令行:按「当前盘面 grid_number 排布」与 T1/T2/T4/T5 约束生成 DiceRewardConfig 表 JSON不含保存
* 用法pnpm tsx scripts/generate-dice-reward-index.ts [t1Min] [t2Min] [t4Fixed] [t5Fixed]
* 默认3 5 1 1T4/T5 为顺、逆加权条数固定值)
*
* 生成逻辑见 src/views/plugin/dice/reward_config/utils/generateIndexByRules.ts
*/
import {
buildRowsFromTiers,
computeBoardFrequencies,
DEFAULT_TIER_REAL_EV_STANDARDS,
generateTiers,
summarizeCounts
} from '../src/views/plugin/dice/reward_config/utils/generateIndexByRules'
const grids = [
20, 27, 24, 10, 5, 15, 8, 22, 30, 23, 16, 12, 13, 7, 17, 9, 21, 26, 6, 29, 19, 11, 25, 14, 28, 18
]
const args = process.argv.slice(2).map((x) => parseInt(x, 10))
const t1 = Number.isFinite(args[0]) ? args[0] : 3
const t2 = Number.isFinite(args[1]) ? args[1] : 5
const x4 = Number.isFinite(args[2]) ? args[2] : 1
const x5 = Number.isFinite(args[3]) ? args[3] : 1
const constraints = {
t1MinCw: t1,
t2MinCw: t2,
t4FixedCw: x4,
t5FixedCw: x5,
t1MinCcw: t1,
t2MinCcw: t2,
t4FixedCcw: x4,
t5FixedCcw: x5
}
const gen = generateTiers({ grids, constraints })
if (gen.ok === false) {
console.error(gen.message)
process.exit(1)
}
const board = computeBoardFrequencies(grids)
if (board === null) {
console.error('computeBoardFrequencies failed')
process.exit(1)
}
const rows = buildRowsFromTiers(grids, gen.tiers, DEFAULT_TIER_REAL_EV_STANDARDS)
const sc = summarizeCounts(board, gen.tiers)
console.log(JSON.stringify({ weighted: { cw: sc.cw, ccw: sc.ccw }, rows }, null, 2))