Pupułka
Hey, good!

Dołączył: 11 Sie 2014 Posty: 8
|
Wysłany: 28 Sierpień 2014, 21:15 Wzór na progi nagród
|
|
|
Czołem,
kiedyś przeczytałem post JB chyba, na może FLD, w którym pisał -- tak mi się majaczyło -- że nagrody za kombosy są w jakiś sposób związane z wartością pierwiastka z czy potęgi dwójki. Wróciłem dzisiaj do tego zagadnienia, i nastąpił... nieskoordynowany szereg programistyczno-matematyczno-Google'owo-Wolfram|Alpha'owych rozważań, w wyniku których udało mi się ustalić... jeśli cokolwiek, to to, że wzór na liczbę pięter n-tej nagrody w Icy Tower to, w PHP-owym zapisie, Kod: | round(pow(2, ($n - 8) / 2) * 100) | . Jestem laikiem, więc nie potrafię opisać, co dokładnie mu dolega. Pewnie jest niedokładny, niezredukowany do optymalnego zapisu, i tak dalej. Ale, caveat lector, może ktoś coś z tych rozważań zabawnego wyciągnie. Może wiedziałbym nieco lepiej, co tu zrobiłem, gdybym był w ostatnich dniach w lepszej formie.
W każdym razie poniższe pokazuje chyba kilka ciekawych rzeczy, w sensie liczbowym.
Kod: | 20:32 *** Zl joined #freelunchdesign
Free Lunch Design's official channel "old" edition | Visit us at http://www.freelunchdesign.com/forum/ | Old topic is old.
Topic set by JohnBeak!~John.Beak@13.121.broadband5.iol.cz on Mon May 26 2014 12:41:40 GMT+0200 (CEST)
20:33 Zl What's the formula for the amount of floors required by the nth reward again?
20:33 Zl int floors_required(int nth_reward_type)
20:37 Zl Ah wait, I think I remembered (from when it was mentioned on FLD last time).
20:38 Zl I think it's sqrt(2) * floors_required(nth_reward_type - 1) .
20:39 Zl ...Now I'm trying to think how to define it non-recursively. >_<
20:39 Zl Wah why am I such an abysmal programmer.
20:42 Zl *puts on small voice* Help.
20:44 Zl Wait...
20:46 Zl 1 = 4
20:46 Zl 2 = 4*1.41
20:46 Zl r = 1.41
20:47 Zl 3 = (3r)r = 3r*r2
20:48 Zl 4 = (3r*r^2)r = (???)*r^3
20:48 Zl n = (???)*r^n
20:49 Zl I made mistakes in this even. >_<
20:55 Zl http://www.wolframalpha.com/input/?i=x(n)+=+sqrt(2)+*+x(n+-+1)
20:55 Zl I'm not sure I understand the output.
21:09 Zl Okay, wait.
21:10 Zl After mad guessing I arrived at 2^((n+5)/2)*1.1.
21:10 Zl * 2^((n+5)/2)*1.1
21:10 Zl Inaccurate for lower n.
21:12 Zl <?php for($i = 1; $i <= 20; $i++) printf("%dth combo reward = from %d floors\n", $i, round(1.1 * pow(2, ($i + 5) / 2)));
21:14 Zl Actually, the coefficient should be 1.105, not 1.1.
21:15 Zl Or, fuck, even better, 1.10485.
21:15 Zl This way the 14th reward is 800 and the 20th, 6400.
21:16 Zl Well, 1.10485 it is then. Nice magic number.
21:17 Zl <?php for($i = 1, $m = 1.10485, $n = 20; $i <= $n; $i++) printf("%dth combo reward = from %d floors\n", $i, round($m * pow(2, ($i + 5) / 2)));
21:17 Zl http://pastebin.com/WcXLn5Sm
21:18 Zl FUUUUUCK.
21:19 Zl Now I caught myself trying to think of the algorithm to determine $m to the best possible value. >_<
21:19 Zl It never ends. ;_;
21:21 Zl Wait...
21:26 Zl Wah. It's 1.1048543456 exactly, at least as far as PHP's precision allows to tell.
21:26 Zl But I still don't understand the significance of that number. ;_;
21:26 Zl But it shows in Google!... https://www.google.com/search?q="1.1048543456"
21:28 Zl <?php for($i = 1, $m = 1.104854345605, $n = 30; $i <= $n; $i++) printf("%dth combo reward = from %f floors\n", $i, $m * pow(2, ($i + 5) / 2));
21:28 Zl Well, at least I know the 30th Icy Tower reward should have exactly 204800 floors.
21:28 Zl Heh.
21:29 Zl Knowing that Icy Tower only supports a limited number of floors, owing to the max value of the datatype, this could serve to infer the max number of rewards Icy Tower can possibly support.
21:29 Zl Because certain rewards, rewards which ought to belong to a certain number of floors, will never be reachable.
21:30 Zl ...Now what's that number.
21:30 Zl "static final double TWO_TO_NEGATIVE_HALF_POW"
21:31 Zl Hmmmmmm.
21:33 Zl static final double TWO_TO_NEGATIVE_HALF_POW[] = { 1.0000000000E+00f, 7.0710678119E-01f, 5.0000000000E-01f, 3.5355339059E-01f, 2.5000000000E-01f, 1.7677669530E-01f, 1.2500000000E-01f, 8.8388347648E-02f, 6.2500000000E-02f, 4.4194173824E-02f, 3.1250000000E-02f, 2.2097086912E-02f, 1.5625000000E-02f, 1.1048543456E-02f,
21:33 Zl I don't understaaaaaaaaand.
21:36 Zl 2^(-.5) is 7.07106... and so on.
21:36 Zl But what's the formula for my 1.10485...?
21:39 Zl Got it!... Kind of.
21:39 Zl 2^(13*-.5)
21:41 Zl Okay.
21:42 Zl The magic combo number is pow(2, 13 * -.5) * 100 .
21:42 Zl But now, where did the 13 come from? ;_;
21:43 Zl <?php for($i = 1, $m = pow(2, 13 * -.5) * 100, $n = 100; $i <= $n; $i++) printf("%03dth combo reward = from %f floors\n", $i, $m * pow(2, ($i + 5) / 2));
21:43 Zl http://pastebin.com/JKw3Nj5U
21:44 Zl 096th combo reward = from 1759218604441600.250000 floors
21:44 Zl 097th combo reward = from 2487910809580380.000000 floors
21:44 Zl 098th combo reward = from 3518437208883200.500000 floors
21:44 Zl 099th combo reward = from 4975821619160760.000000 floors
21:44 Zl 100th combo reward = from 7036874417766401.000000 floors
21:44 Zl Math is bizarre.
21:46 Zl Oh well.
21:48 Zl In the final iteration of the code, there are still two numbers that to me look arbitrary, and which perhaps should somehow be reduced to just one single value: the 13 in the definition of the magic value, and 5 in the floor threshold calculation. But it's good enough, even if I don't understand at all what I've been doing for the last hour.
21:54 Zl All right, final version, to i.a. circumvent some apparent printf limitations:
21:54 Zl <?php for($i = 1, $m = pow(2, 13 * -.5), $n = 100; $i <= $n; $i++) printf("%03dth combo reward = from %.0f floors\n", $i, round(100 * $m * pow(2, ($i + 5) / 2)));
21:54 Zl The mystery of the 13 I am leaving for anyone else to solve.
21:55 Zl I am happy enough to have persisted inquisitively enough to restate the "magic value" into an expression.
21:56 Zl http://pastebin.com/4CHp11ZN
21:59 Zl Wah, 13 * -.5 could be written -6.5 obviously.
22:01 Zl All right, I'll post this on Icy.pl. Maybe it will entertain somebody. |
Kod: | <?php
$reward = function($n)
{
return round(pow(2, ($n - 8) / 2) * 100);
};
for($i = 1; $i <= 2 << 6; $i++)
{
printf("% 3dth combo reward % 30.0f floors\n", $i, $reward($i));
}
?> |
Kod: | >php -f "combo.php"
1th combo reward 9 floors
2th combo reward 13 floors
3th combo reward 18 floors
4th combo reward 25 floors
5th combo reward 35 floors
6th combo reward 50 floors
7th combo reward 71 floors
8th combo reward 100 floors
9th combo reward 141 floors
10th combo reward 200 floors
11th combo reward 283 floors
12th combo reward 400 floors
13th combo reward 566 floors
14th combo reward 800 floors
15th combo reward 1131 floors
16th combo reward 1600 floors
17th combo reward 2263 floors
18th combo reward 3200 floors
19th combo reward 4525 floors
20th combo reward 6400 floors
21th combo reward 9051 floors
22th combo reward 12800 floors
23th combo reward 18102 floors
24th combo reward 25600 floors
25th combo reward 36204 floors
26th combo reward 51200 floors
27th combo reward 72408 floors
28th combo reward 102400 floors
29th combo reward 144815 floors
30th combo reward 204800 floors
31th combo reward 289631 floors
32th combo reward 409600 floors
33th combo reward 579262 floors
34th combo reward 819200 floors
35th combo reward 1158524 floors
36th combo reward 1638400 floors
37th combo reward 2317048 floors
38th combo reward 3276800 floors
39th combo reward 4634095 floors
40th combo reward 6553600 floors
41th combo reward 9268190 floors
42th combo reward 13107200 floors
43th combo reward 18536380 floors
44th combo reward 26214400 floors
45th combo reward 37072760 floors
46th combo reward 52428800 floors
47th combo reward 74145520 floors
48th combo reward 104857600 floors
49th combo reward 148291040 floors
50th combo reward 209715200 floors
51th combo reward 296582080 floors
52th combo reward 419430400 floors
53th combo reward 593164160 floors
54th combo reward 838860800 floors
55th combo reward 1186328320 floors
56th combo reward 1677721600 floors
57th combo reward 2372656641 floors
58th combo reward 3355443200 floors
59th combo reward 4745313281 floors
60th combo reward 6710886400 floors
61th combo reward 9490626562 floors
62th combo reward 13421772800 floors
63th combo reward 18981253125 floors
64th combo reward 26843545600 floors
65th combo reward 37962506250 floors
66th combo reward 53687091200 floors
67th combo reward 75925012499 floors
68th combo reward 107374182400 floors
69th combo reward 151850024999 floors
70th combo reward 214748364800 floors
71th combo reward 303700049998 floors
72th combo reward 429496729600 floors
73th combo reward 607400099995 floors
74th combo reward 858993459200 floors
75th combo reward 1214800199990 floors
76th combo reward 1717986918400 floors
77th combo reward 2429600399981 floors
78th combo reward 3435973836800 floors
79th combo reward 4859200799962 floors
80th combo reward 6871947673600 floors
81th combo reward 9718401599923 floors
82th combo reward 13743895347200 floors
83th combo reward 19436803199847 floors
84th combo reward 27487790694400 floors
85th combo reward 38873606399693 floors
86th combo reward 54975581388800 floors
87th combo reward 77747212799387 floors
88th combo reward 109951162777600 floors
89th combo reward 155494425598774 floors
90th combo reward 219902325555200 floors
91th combo reward 310988851197548 floors
92th combo reward 439804651110400 floors
93th combo reward 621977702395095 floors
94th combo reward 879609302220800 floors
95th combo reward 1243955404790190 floors
96th combo reward 1759218604441600 floors
97th combo reward 2487910809580380 floors
98th combo reward 3518437208883200 floors
99th combo reward 4975821619160760 floors
100th combo reward 7036874417766400 floors
101th combo reward 9951643238321520 floors
102th combo reward 14073748835532800 floors
103th combo reward 19903286476643040 floors
104th combo reward 28147497671065600 floors
105th combo reward 39806572953286080 floors
106th combo reward 56294995342131200 floors
107th combo reward 79613145906572160 floors
108th combo reward 112589990684262400 floors
109th combo reward 159226291813144320 floors
110th combo reward 225179981368524800 floors
111th combo reward 318452583626288640 floors
112th combo reward 450359962737049600 floors
113th combo reward 636905167252577280 floors
114th combo reward 900719925474099200 floors
115th combo reward 1273810334505154560 floors
116th combo reward 1801439850948198400 floors
117th combo reward 2547620669010309120 floors
118th combo reward 3602879701896396800 floors
119th combo reward 5095241338020618240 floors
120th combo reward 7205759403792793600 floors
121th combo reward 10190482676041236480 floors
122th combo reward 14411518807585587200 floors
123th combo reward 20380965352082472960 floors
124th combo reward 28823037615171174400 floors
125th combo reward 40761930704164945920 floors
126th combo reward 57646075230342348800 floors
127th combo reward 81523861408329891840 floors
128th combo reward 115292150460684697600 floors
>Exit code: 0 |
|
Ostatnio zmieniony przez Pupułka 29 Sierpień 2014, 08:46, w całości zmieniany 9 razy |
|