4 ms·
https://github.com/keendreams/keen/blob/master/id_us_a.asm#L65 https://github.com/keendreams/keen/blob/master/id_us_a.asm#L... > baseRndArray dw 1,1,2,3,5,8,13
by ahomescu1 12y ago
https://github.com/keendreams/keen/blob/master/id_us_a.asm#L65 https://github.com/keendreams/keen/blob/master/id_us_a.asm#L...
> baseRndArray dw 1,1,2,3,5,8,13,21,54,75,129,204
Hah he got the Fibonacci series wrong (it's supposed to be ...13, 21, 34, 55, 89, 144, unless he did this on purpose).
- sillysaurus3 12y agoCarmack got many things wrong. The interesting thing is, none of his mistakes mattered, otherwise he would have fixed them. So you wind up with emergent behavior and bugs become features, like bunnyhopping or rocket jumping. In this case, 204/129 ~= 1.581, which is pretty close to the golden ratio 1.618. In fact, let's just list all the ratios: 1/1 = 1 2/1 = 2 3/2 = 1.5 5/3 = 1.667 8/5 = 1.6 13/8 = 1.625 21/13 = 1.615 54/21 = 2.571 75/54 = 1.389 129/75 = 1.72 204/129 = 1.581 And for the regular series: 1/1 = 1 2/1 = 2 3/2 = 1.5 5/3 = 1.667 8/5 = 1.6 13/8 = 1.625 21/13 = 1.615 34/21 = 1.619 55/34 = 1.618 89/55 = 1.618 144/89 = 1.618 Here's a plot of the ratios (regular series in blue, Carmack's in red...ish): http://i.imgur.com/WA7ipZA.png http://i.imgur.com/WA7ipZA.png In this case, we end up with some lovely oscillations in the second half of Carmack's series. But does it look good for graphics, or behave well for gameplay purposes? No idea! Someone should find out what it's used for. It's an interesting little bit of historical excavation.
- ahomescu1 12y agoIt looks like the sequence was meant for a RNG, so getting it wrong probably had no impact on anything (it might have made the RNG weaker, but that's about it). EDIT: I think that sequence isn't even used anywhere (I couldn't find any reference to it).
- Chinjut 12y agoWhat's the relevance of these ratios to Carmack's purpose in extrapolating the series? At any rate, the limiting ratio of successive terms in the altered Fibonacci series 21,54,75,129,204,..., is the same as for the ordinary Fibonacci series, even if the convergence is slower (the difference between this altered Fibonacci series and the original Fibonacci series is just another version of the Fibonacci series, shifted over and multiplied by 20).
- sillysaurus3 12y agoApparently Carmack didn't actually use it anyway, so I suppose there wasn't any purpose. But Carmack's series is significantly different from the normal Fibonacci series, because it only consists of the first ten elements, which isn't enough time to converge. If it was used in actual graphics or gameplay, it would have had a significantly different effect than a normal Fib sequence. I just thought it was interesting, and another example of the same type of style which led to rocket jumping or bunnyhopping, which were also accidents.
- Chinjut 12y agoIt's not clear that Carmack's purpose in using the Fibonacci series was to take successive ratios to approximate "the golden ratio" (if it was the golden ratio he cared about, he could just as well have directly calculated (1 + sqrt(5))/2). He quite possibly could have been interested in the Fibonacci sequence for some other reason, or no reason at all.
- deleted 12y ago[deleted]
- prezjordan 12y agoWell, you can keep do this with any two numbers a, b such that a + b > 0 and you'll end up with the golden ratio :)
- Chinjut 12y agoThe condition a + b > 0 is neither necessary nor sufficient; rather, the precise condition you need is that b != k * a, where k = (1 - sqrt(5))/2. But, yes, Carmack's Fibonacci sequence gone awry would still (if continued without further error) produce the golden ratio in the same way as the ordinary Fibonacci sequence.
- endgame 12y agoAnother piece of emergent behaviour is the "impossible pogo trick": http://www.shikadi.net/keenwiki/Impossible_Pogo_Trick http://www.shikadi.net/keenwiki/Impossible_Pogo_Trick