forked from 1ekf/ExidleStars
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCalculator2.wls
273 lines (242 loc) · 14.1 KB
/
Calculator2.wls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
#!/usr/bin/env wolframscript
(* ::Package:: *)
(* ::Title::Closed:: *)
(*Optimal Star Distribution Calculator*)
(* ::Subtitle:: *)
(*by Eaux Tacous#1021*)
(* ::Section::Closed:: *)
(*Constants*)
(* ::Text:: *)
(*Taken from exidle wiki.*)
symbTable = {"y", "z", "s", "u", "v", "w", "\[Alpha]", "\[Beta]", "\[Gamma]", "\[Delta]", "\[CurlyEpsilon]", "\[Zeta]", "\[Eta]", "\[Theta]", "\[Iota]", "\[Kappa]", "\[Lambda]", "\[Nu]", "\[Xi]"};
(* ::Section::Closed:: *)
(*Helper Functions*)
myprint = Sow @* (Style[#, RGBColor["#ccc"], Bold]&) @* Row @* List;
(* Prevent Mathematica from complaining *)
externLP = Flatten[LinearProgramming[##]]&;
(* ::Section::Closed:: *)
(*Main algorithm*)
calcoptBLPWrapper[in___] :=
Print[
StringReplace[
"data:image/png;base64," ~ StringJoin ~ ExportString[
im = Rasterize[
Block[{time, eval, $Messages, Print = myprint},
MemoryConstrained[
TimeConstrained[
Print["输入:", ""[in]];
eval = EvaluationData[Catch[calcoptBLP[in]]];
Print["计算用时:", eval["Timing"]];
If[eval["Success"],
eval["Result"]
,
Print["发生错误"];
Print["请在 GitHub 上联系作者,并附加以下信息"];
Print /@ eval["Messages"];
],
10,
Print @ Style["Error: Timeout", Hue[{0, .8, .9}]]
],
100*^6,
Print @ Style["Error: Out of memory", Hue[{0, .8, .9}]]
]
] // Reap // Last // Last // Column,
Background -> RGBColor["#222"], BaselinePosition -> Center, ImageFormattingWidth -> Infinity, ImageResolution -> 100
],
{"Base64", "PNG"},
"ColorMapLength" -> 24,
CompressionLevel -> 1,
Dithering -> None,
IncludeMetaInformation -> {}
],
{"\n" -> ""}
]
];
calcoptBLP[___] :=
Throw[Print @ Style["输入无效", Hue[{0, .8, .9}]]];
calcoptBLP[llf_, initstars:Except[_Integer]?NumericQ, opt_.] :=
calcoptBLP[llf, Round[initstars], opt]
calcoptBLP[llf_?(NumericQ @ # && 10 <= # <= 1*^6&), initstars_Integer?(0 <= # <= 1*^9&), Optional[Automatic, Automatic]] :=
Block[{lpsi, level},
lpsi = (llf / 25 - 1) / Log2[10];
level = Clip[Quotient[lpsi, 20, 90], {0, 24}];
Print["Automatic third argument used: ", level];
calcoptBLP[llf, initstars, level]
];
calcoptBLP[llf_?(NumericQ @ # && 10 <= # <= 1*^6&), initstars_Integer?(0 <= # <= 1*^9&), ex_Integer /; 0 <= ex <= 24] :=
calcoptBLP[llf, initstars, Prepend[Table[Clip[1 + 0.04 * (ex - 2 n), {1, 1.08}], {n, 0, 17}], 9]];
calcoptBLPComp = ImportString[
"V0RYMQECAAAAAAAAAAAAAJbFWlfSDMNOWc9IwoQIuDHg/8cZAAAAAAAAeJztPdtuW0eSvyIY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EhT7in+yHCsdWTzLxPx299SM29d3d9s/4uFgLoblPjZFi6IGf98DD0/N18LMyy+Wsu2L
woohi1SkPV+yupes7jNkdfOSdTQrLks+R3kQqZsgPT6fobin6xAt3Oq9pKb/tKnpn5qWpjuuJFPI
cgSPQEOvf6FstfptGhOhngsUr/wDp7QveeufkLeenLNOfhCVZB9vIroXV5d7I6LPlOB+tkz06+vr
d7vjc1EKfjAbpeB/Wj5a1kXXjrHlCicAvDiGGgcjGixZyLYIde03yTq1zf+kxt+u8ZFkrLj/rGWR
lygOyVu9Xm2vnrar8Ojs/QqSg+vlKwD8P3z70kg=",
{"Base64", "WDX"}];
calcoptBLP[llf_?(NumericQ @ # && 10 <= # <= 1*^6&), initstars_Integer?(0 <= # <= 1*^9&), ex_List /; Length[ex] == 19] :=
Block[{fincosts, vars, finlevs, initpows, finpows, totpow, pows, powsd, grid, len = 19},
{fincosts, vars, finlevs, initpows, finpows} = calcoptBLPComp[llf, initstars, ex];
fincosts = Round@fincosts;
vars = Round@vars;
finlevs = Round@finlevs;
totpow = Total[initpows + finpows];
pows = (initpows + finpows) / totpow;
powsd = finpows / totpow;
Print["使用星星数量:", Total @ fincosts];
Print["剩余星星数量:", initstars - Total @ fincosts];
grid = {
symbTable, NumberForm[#, Infinity, NumberSigns -> {"-", "+"}]& /@ finlevs, fincosts, vars, finlevs + vars, PercentForm[#, {Infinity, 4}]& /@ pows, Table[
Which[
finlevs[[i]] == 0,
"无"
,
powsd[[i]] >= 0.01,
"最高"
,
powsd[[i]] >= 0.001,
"高"
,
powsd[[i]] >= 0.0001,
"中"
,
True,
"低"
], {i, len}
]
} // Transpose;
grid = Prepend[grid, {"变量", "购买数量", "星星数量", "购买前等级", "购买后等级", "贡献度", "优先级"}];
Print[Grid[
grid, Frame -> All, FrameStyle -> Thin, ItemStyle -> {
Automatic, Switch[Last @ #,
"top",
Hue[{0, .8, .9}]
,
"high",
Hue[{55 / 360, .65, .8}]
,
"medium",
Hue[{1 / 3, .6, .6}]
,
"low",
Hue[{200 / 360, .1, .7}]
,
"none",
RGBColor["#888"]
,
_,
Automatic
]& /@ grid
}
]];
]