レベル | 成功率 | 木材 | 石材 | 銅材 | 銀材 | 金材 |
---|---|---|---|---|---|---|
1 → 2 | 100 | 2.00 | ||||
2 → 3 | 100 | 3.00 | ||||
3 → 4 | 100 | 5.00 | ||||
4 → 5 | 90 | 6.63 | 1.10 | |||
5 → 6 | 90 | 7.73 | 2.21 | |||
6 → 7 | 90 | 8.84 | 3.31 | |||
7 → 8 | 90 | 9.94 | 4.42 | |||
8 → 9 | 90 | 11.05 | 5.52 | |||
9 → 10 | 80 | 14.80 | 7.40 | 1.23 | ||
10 → 11 | 80 | 8.63 | 2.47 | |||
11 → 12 | 80 | 9.87 | 3.70 | |||
12 → 13 | 80 | 11.10 | 4.93 | |||
13 → 14 | 80 | 12.33 | 6.17 | |||
14 → 15 | 80 | 12.33 | 7.40 | 1.23 | ||
15 → 16 | 80 | 8.63 | 2.47 | |||
16 → 17 | 80 | 9.87 | 3.70 | |||
17 → 18 | 80 | 11.10 | 4.93 | |||
18 → 19 | 80 | 12.33 | 6.17 | |||
19 → 20 | 70 | 20.89 | 8.35 | 1.39 | ||
20 → 21 | 60 | 31.90 | 11.16 | 3.19 | ||
21 → 22 | 55 | 25.77 | 13.74 | 5.15 | ||
22 → 23 | 50 | 18.59 | 16.73 | 7.44 | ||
23 → 24 | 45 | 50.56 | 20.22 | 10.11 | ||
24 → 25 | 40 | 44.27 | 13.28 | |||
25 → 26 | 35 | 36.58 | 17.07 | |||
26 → 27 | 30 | 81.21 | 27.07 | 21.66 | ||
27 → 28 | 25 | 75.76 | 27.27 | |||
28 → 29 | 20 | 68.49 | 34.24 | |||
29 → 30 | 10 | 67.79 | 54.23 | |||
30 → 31 | 95 | 157.50 | ||||
31 → 32 | 90 | 221.00 | ||||
32 → 33 | 85 | 303.10 | 139.89 | |||
33 → 34 | 80 | 419.27 | 197.30 | |||
34 → 35 | 75 | 588.73 | 274.74 | 117.75 | ||
35 → 36 | 70 | 389.90 | 167.10 | |||
36 → 37 | 50 | 687.78 | 297.42 | 130.12 | ||
37 → 38 | 30 | 568.49 | 270.71 | |||
38 → 39 | 20 | 958.79 | 445.15 | 513.64 | ||
39 → 40 | 10 | 768.33 | 903.91 | |||
合計 | 1955.48 | 1901.30 | 2301.03 | 1797.89 | 1612.59 | |
成功率30%以上 | 1955.48 | 1850.55 | 1573.75 | 831.61 | 460.29 | |
成功率50%以上 | 1878.71 | 1826.28 | 1193.67 | 633.61 | 424.17 |
Last active
November 10, 2018 08:04
-
-
Save pinzolo/980cf21a27b7abce24d52014e7357537 to your computer and use it in GitHub Desktop.
[ボク殺3] ☆4AF素材期待値
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strconv" | |
) | |
type num int | |
func (n num) val() val { | |
return val(float64(n)) | |
} | |
type val float64 | |
func (v val) String() string { | |
if v == 0.0 { | |
return "" | |
} | |
return fmt.Sprintf("%0.2f", v) | |
} | |
type definition struct { | |
lv int | |
rate int | |
wood num | |
stone num | |
bronze num | |
silver num | |
gold num | |
} | |
func (def definition) maxCount() int { | |
return ((100 - def.rate) / 5) + 1 | |
} | |
func (def definition) calcRate(i int) int { | |
return def.rate + ((i - 1) * 5) | |
} | |
func (def definition) percentages() []float64 { | |
ps := make([]float64, def.maxCount()) | |
base := 1.0 | |
for i := 1; i <= def.maxCount(); i++ { | |
rate := def.calcRate(i) | |
ps[i-1] = base * (float64(rate) / 100) | |
base *= 1.0 - (float64(rate) / 100) | |
} | |
return ps | |
} | |
func (def definition) expectation() expectation { | |
ps := def.percentages() | |
return expectation{ | |
wood: calcExpectation(def.wood, ps), | |
stone: calcExpectation(def.stone, ps), | |
bronze: calcExpectation(def.bronze, ps), | |
silver: calcExpectation(def.silver, ps), | |
gold: calcExpectation(def.gold, ps), | |
} | |
} | |
type expectation struct { | |
lv int | |
rate int | |
wood val | |
stone val | |
bronze val | |
silver val | |
gold val | |
} | |
func (exp expectation) add(other expectation) expectation { | |
return expectation{ | |
wood: exp.wood + other.wood, | |
stone: exp.stone + other.stone, | |
bronze: exp.bronze + other.bronze, | |
silver: exp.silver + other.silver, | |
gold: exp.gold + other.gold, | |
} | |
} | |
func calcExpectation(n num, percentages []float64) val { | |
if n == 0 { | |
return 0.0 | |
} | |
var exp float64 | |
for i, f := range percentages { | |
base := int(n) * (i + 1) | |
exp += float64(base) * f | |
} | |
return val(exp) | |
} | |
type rateSum struct { | |
rate int | |
sum expectation | |
} | |
var allDefs = []definition{ | |
definition{lv: 1, rate: 100, wood: 2}, | |
definition{lv: 2, rate: 100, wood: 3}, | |
definition{lv: 3, rate: 100, wood: 5}, | |
definition{lv: 4, rate: 90, wood: 6, stone: 1}, | |
definition{lv: 5, rate: 90, wood: 7, stone: 2}, | |
definition{lv: 6, rate: 90, wood: 8, stone: 3}, | |
definition{lv: 7, rate: 90, wood: 9, stone: 4}, | |
definition{lv: 8, rate: 90, wood: 10, stone: 5}, | |
definition{lv: 9, rate: 80, wood: 12, stone: 6, bronze: 1}, | |
definition{lv: 10, rate: 80, stone: 7, bronze: 2}, | |
definition{lv: 11, rate: 80, stone: 8, bronze: 3}, | |
definition{lv: 12, rate: 80, stone: 9, bronze: 4}, | |
definition{lv: 13, rate: 80, stone: 10, bronze: 5}, | |
definition{lv: 14, rate: 80, wood: 10, bronze: 6, silver: 1}, | |
definition{lv: 15, rate: 80, bronze: 7, silver: 2}, | |
definition{lv: 16, rate: 80, bronze: 8, silver: 3}, | |
definition{lv: 17, rate: 80, bronze: 9, silver: 4}, | |
definition{lv: 18, rate: 80, bronze: 10, silver: 5}, | |
definition{lv: 19, rate: 70, wood: 15, silver: 6, gold: 1}, | |
definition{lv: 20, rate: 60, wood: 20, silver: 7, gold: 2}, | |
definition{lv: 21, rate: 55, stone: 15, silver: 8, gold: 3}, | |
definition{lv: 22, rate: 50, bronze: 10, silver: 9, gold: 4}, | |
definition{lv: 23, rate: 45, wood: 25, silver: 10, gold: 5}, | |
definition{lv: 24, rate: 40, stone: 20, gold: 6}, | |
definition{lv: 25, rate: 35, bronze: 15, gold: 7}, | |
definition{lv: 26, rate: 30, wood: 30, silver: 10, gold: 8}, | |
definition{lv: 27, rate: 25, stone: 25, gold: 9}, | |
definition{lv: 28, rate: 20, bronze: 20, gold: 10}, | |
definition{lv: 29, rate: 10, silver: 15, gold: 12}, | |
definition{lv: 30, rate: 95, wood: 150}, | |
definition{lv: 31, rate: 90, wood: 200}, | |
definition{lv: 32, rate: 85, wood: 260, stone: 120}, | |
definition{lv: 33, rate: 80, wood: 340, stone: 160}, | |
definition{lv: 34, rate: 75, wood: 450, stone: 210, bronze: 90}, | |
definition{lv: 35, rate: 70, stone: 280, bronze: 120}, | |
definition{lv: 36, rate: 50, stone: 370, bronze: 160, silver: 70}, | |
definition{lv: 37, rate: 30, bronze: 210, silver: 100}, | |
definition{lv: 38, rate: 20, bronze: 280, silver: 130, gold: 150}, | |
definition{lv: 39, rate: 10, silver: 170, gold: 200}, | |
} | |
func main() { | |
rss := []*rateSum{ | |
&rateSum{rate: 0}, | |
&rateSum{rate: 30}, | |
&rateSum{rate: 50}, | |
} | |
exps := make([]expectation, len(allDefs)) | |
for i, def := range allDefs { | |
exp := def.expectation() | |
for _, rs := range rss { | |
if def.rate >= rs.rate { | |
rs.sum = rs.sum.add(exp) | |
} else { | |
rs.sum = rs.sum.add(expectation{ | |
wood: def.wood.val(), | |
stone: def.stone.val(), | |
bronze: def.bronze.val(), | |
silver: def.silver.val(), | |
gold: def.gold.val(), | |
}) | |
} | |
} | |
exps[i] = exp | |
} | |
printAsMd(exps, rss) | |
} | |
func printAsMd(exps []expectation, rss []*rateSum) { | |
fmt.Printf("|レベル|成功率|木材|石材|銅材|銀材|金材|\n") | |
fmt.Printf("|--:|--:|--:|--:|--:|--:|--:|\n") | |
for i, exp := range exps { | |
printExpAsMd(fmt.Sprintf("%d → %d", i+1, i+2), strconv.Itoa(findRate(i+1)), exp) | |
} | |
for _, rs := range rss { | |
label := "合計" | |
if rs.rate > 0 { | |
label = fmt.Sprintf("成功率%d%%以上", rs.rate) | |
} | |
printExpAsMd(label, "", rs.sum) | |
} | |
} | |
func printExpAsMd(label string, rate string, exp expectation) { | |
fmt.Printf("|%s|%s|%s|%s|%s|%s|%s|\n", label, rate, exp.wood, exp.stone, exp.bronze, exp.silver, exp.gold) | |
} | |
func findRate(lv int) int { | |
for _, def := range allDefs { | |
if def.lv == lv { | |
return def.rate | |
} | |
} | |
return 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment