mathe可否打印出有效的完整的战斗匹配的路径出来。
我发现我前面4#的计算有误。忽略了一种情况,就是每次战斗后,受伤的角色不一定在下一轮必然选上加入战斗。所以,实际上样本空间是$C_n^2C_{n-1}^2C_{n-2}^2C_{n-3}^2...$,考虑同归于尽的场合,最终的事件空间略小于这个数目。
- {3,2,3,2/3}
- {4,11,18,11/18}
- {5,57,152,3/8}
- {6,394,1696,197/848}
- {7,6090,24068,3045/12034}
- {8,151555,433660,30311/86732}
- {9,4105581,9691096,4105581/9691096}
复制代码
比如$n=8$的情况,我随便挑选了$20$组。
比如这种情况${{{2,2}},{{{7,7},{8,8}},{{1,1},{4,4}},{{5,5},{6,6}},{{4,3},{8,1}},{{3,3},{6,1}}}}$ ,最终幸存的是$2$号,体力值为$2$, 经历了$5$轮战斗,$(7,8), (1,4),(5,6),(4,8),(3,6)$
比如这种情况${{{5, 4}}, {{{2, 2}, {3, 3}}, {{3, 1}, {6, 6}}, {{6, 3}, {8, 8}}, {{4, 4}, {7, 7}}, {{7, 3}, {8, 2}}, {{1, 1}, {5, 5}}}}$ , 最终幸存的是$5$号,体力值为$4$, 经历了$6$轮战斗,$(2,3), (3,6),(6,8),(4,7),(7,8),(1,5)$
比如这种情况${{{8,1}},{{{1,1},{2,2}},{{2,1},{3,3}},{{3,1},{4,4}},{{4,1},{5,5}},{{5,1},{6,6}},{{6,1},{7,7}},{{7,1},{8,8}}}}$ ,最终幸存的是$8$号,体力值为$1$, 经历了$7$轮战斗,$(1,2), (2,3),(3,4),(4,5),(5,6),(6,7),(7,8)$
比如这种情况${{},{{{3,3},{5,5}},{{2,2},{4,4}},{{4,2},{6,6}},{{7,7},{8,8}},{{5,2},{6,2}},{{1,1},{8,1}}}}$ , 最终无人幸存, 经历了$6$轮战斗,$(3,5), (2,4),(4,6),(7,8),(5,6),(1,8)$
- {{{2,2}},{{{7,7},{8,8}},{{1,1},{4,4}},{{5,5},{6,6}},{{4,3},{8,1}},{{3,3},{6,1}}}}
- {{{5,4}},{{{2,2},{3,3}},{{3,1},{6,6}},{{6,3},{8,8}},{{4,4},{7,7}},{{7,3},{8,2}},{{1,1},{5,5}}}}
- {{{8,1}},{{{1,1},{2,2}},{{2,1},{3,3}},{{3,1},{4,4}},{{4,1},{5,5}},{{5,1},{6,6}},{{6,1},{7,7}},{{7,1},{8,8}}}}
- {{{7,3}},{{{1,1},{2,2}},{{6,6},{8,8}},{{2,1},{5,5}},{{3,3},{4,4}},{{4,1},{7,7}},{{5,3},{8,2}}}}
- {{{6,3}},{{{3,3},{6,6}},{{1,1},{4,4}},{{4,3},{2,2}},{{4,1},{5,5}},{{7,7},{8,8}},{{8,1},{5,1}}}}
- {{},{{{3,3},{5,5}},{{2,2},{4,4}},{{4,2},{6,6}},{{7,7},{8,8}},{{5,2},{6,2}},{{1,1},{8,1}}}}
- {{},{{{1,1},{6,6}},{{2,2},{5,5}},{{7,7},{8,8}},{{8,1},{5,3}},{{4,4},{6,5}},{{6,1},{3,3}}}}
- {{{5,5}},{{{6,6},{7,7}},{{1,1},{2,2}},{{3,3},{8,8}},{{2,1},{4,4}},{{4,2},{8,5}},{{8,1},{7,1}}}}
- {{{5,1}},{{{4,4},{8,8}},{{8,4},{2,2}},{{3,3},{5,5}},{{6,6},{7,7}},{{1,1},{5,2}},{{7,1},{8,2}}}}
- {{{7,4}},{{{4,4},{6,6}},{{1,1},{8,8}},{{2,2},{3,3}},{{6,2},{8,7}},{{3,1},{7,7}},{{5,5},{8,1}}}}
- {{},{{{5,5},{6,6}},{{1,1},{8,8}},{{8,7},{3,3}},{{2,2},{4,4}},{{4,2},{6,1}},{{7,7},{8,4}}}}
- {{},{{{1,1},{4,4}},{{3,3},{8,8}},{{4,3},{7,7}},{{5,5},{6,6}},{{6,1},{2,2}},{{7,3},{8,5}}}}
- {{{7,1}},{{{4,4},{5,5}},{{1,1},{2,2}},{{6,6},{7,7}},{{2,1},{8,8}},{{8,6},{3,3}},{{8,3},{5,1}}}}
- {{{8,2}},{{{3,3},{5,5}},{{1,1},{2,2}},{{5,2},{7,7}},{{2,1},{6,6}},{{4,4},{7,2}},{{6,4},{8,8}}}}
- {{{5,5}},{{{1,1},{8,8}},{{4,4},{6,6}},{{3,3},{7,7}},{{6,2},{8,7}},{{2,2},{7,4}},{{7,2},{8,1}}}}
- {{{6,1}},{{{1,1},{4,4}},{{4,3},{8,8}},{{3,3},{7,7}},{{5,5},{6,6}},{{2,2},{8,4}},{{8,2},{7,4}}}}
- {{},{{{2,2},{8,8}},{{1,1},{7,7}},{{5,5},{8,6}},{{8,1},{3,3}},{{4,4},{6,6}},{{6,2},{7,6}}}}
- {{{6,1}},{{{1,1},{5,5}},{{2,2},{6,6}},{{6,4},{3,3}},{{5,4},{7,7}},{{4,4},{8,8}},{{8,4},{7,2}}}}
- {{},{{{5,5},{7,7}},{{1,1},{4,4}},{{3,3},{8,8}},{{2,2},{6,6}},{{7,2},{8,5}},{{4,3},{6,4}}}}
- {{{7,3}},{{{5,5},{8,8}},{{2,2},{6,6}},{{6,4},{8,3}},{{1,1},{3,3}},{{3,2},{4,4}},{{4,1},{7,7}}}}
复制代码
附上我的代码:
- fight[pair0_] :=
- Module[{pair = pair0},
- Select[{{pair[[1, 1]], pair[[1, 2]] - pair[[2, 1]]}, {pair[[2, 1]],
- pair[[2, 2]] - pair[[1, 1]]}}, #[[2]] > 0 &]
- ]
- sss = Table[{n, data = {{{#, #} & /@ Range[n], {}}};
- Do[data =
- Flatten[Table[
- If[Length[round[[1]]] > 1,
- Table[{Join[fight[i], Complement[round[[1]], i]],
- Join[round[[2]], {i}]}, {i,
- Subsets[round[[1]], {2}]}], {round}], {round, data}],
- 1], {n - 1}]; t = Select[data, Length[#[[1]]] == 0 &];
- Length[t], Length[data], Length[t]/Length[data], data}, {n, 1, 7}]
复制代码
|