Posts for OmnipotentEntity

Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
There are at least two other ways to solve this integral other than contour integration. Though I didn't realize that the answer was... just sitting on wikipedia for me to lift it. That would have been nice to know.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Here's a fun integral that I had to solve recently. Integral -inf to inf exp(-a^2 x^2)/(1 + x^2) dx Interested to see what approaches you take. (You may assume a is positive.)
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Warp wrote:
I wish somebody would integrate the math plugin into the forum... http://tasvideos.org/forum/viewtopic.php?t=19519
I'm pretty sure it won't be that easy. I remember back in the day Bisqwit telling me that he couldn't even update to phpbb 3.0 because there was so much backend integration between the site and the forum. All work that would have to be redone. (In fact, I believe we're actually still on phpBB 2.0). The mod I linked is for phpbb 3.0.x so it would need to be reworked for 2.0. It's not as simple as just installing it.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
FractalFusion wrote:
OmnipotentEntity wrote:
But if $$a$$ is not a real number then bringing $$\mathrm{e}^{a t}$$ into the $$\Re$$ isn't allowed. But we get the same answer. So if we try to compute the integral in this way it's an abuse of notation.
Instead of using Re(eiωx) for cos(ωx), use (1/2)(eiωx+e-iωx) instead. (This follows from Euler's formula.) Then it will work out to be the same answer. This way, we do not need to worry about abuse of notation; it works when a is complex. In fact, it now works even if ω is complex. (Euler's formula holds for complex values as well.) By the way, the image you uploaded isn't visible in imgur without going into expand mode. It may be because the background color is regarded as transparent, even though it should be white. Edit: The image is directly linked now, which solves the problem.
I did mention that it works with the cosine formula. I was hoping to use the abuse of notation, provided I knew exactly where it works and where it breaks down.
OmnipotentEntity wrote:
(Yes, it is possible to also just use the identity $$\cos(\omega x) = \frac1{2} \left( \mathrm{e}^{i \omega x} + \mathrm{e}^{-i \omega x} \right)$$ and while that's easier than the integration by parts, it's more involved than the abuse.)
Sorry about the transparency issue, the images were always direct links, but I guess imgur wasn't behaving as I expected.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Using latex notation. Sorry about how messy it is. This post rendered as a document: Page 1 Page 2 Let's say that we have an integral: $$\int \cos(\omega x) \mathrm{e}^{a x} dx $$ One method of working this integral is to use integration by parts twice to obtain a copy of the original integral, but that's long and kind of annoying: $$\begin{split} \int \cos(\omega x) \mathrm{e}^{a x} dx &= \frac1{a} \cos(\omega x) \mathrm{e}^{a x} - \int -\frac{\omega}{a} \sin(\omega x) \mathrm{e}^{a x} dx \\ &= \frac1{a} \cos(\omega x) \mathrm{e}^{a x} + \frac{\omega}{a} \int \sin(\omega x) \mathrm{e}^{a x} dx \\ &= \frac1{a} \cos(\omega x) \mathrm{e}^{a x} + \frac{\omega}{a} \left(\frac1{a} \sin(\omega x) \mathrm{e}^{a x} - \int \frac{\omega}{a} \cos(\omega x) \mathrm{e}^{a x} dx\right) \\ &= \frac1{a} \cos(\omega x) \mathrm{e}^{a x} + \frac{\omega}{a^2} \sin(\omega x) \mathrm{e}^{a x} - \frac{\omega^2}{a^2} \int\ \cos(\omega x) \mathrm{e}^{a x} dx \\ \left(a^2 + \omega^2\right)\int \cos(\omega x) \mathrm{e}^{a x} dx &= a \cos(\omega x) \mathrm{e}^{a x} + \omega \sin(\omega x) \mathrm{e}^{a x} \\ \int \cos(\omega x) \mathrm{e}^{a x} dx &= \frac{a}{a^2 + \omega^2} \cos(\omega x) \mathrm{e}^{a x} + \frac{\omega}{a^2 + \omega^2} \sin(\omega x) \mathrm{e}^{a x} \\ \end{split}$$ Instead, we can use the complex domain and compute (assuming $$x$$ is real): $$\int \Re\left\{\mathrm{e}^{i \omega x}\right\} \mathrm{e}^{a x} dx $$ And assuming that $$a$$ is also a real number we can bring it into the Real part and compute the integral simply: $$\begin{split} &= \int \Re\left\{\mathrm{e}^{(a + i \omega) x}\right\} dx \\ &= \Re\left\{\frac1{a + i \omega}\mathrm{e}^{(a + i \omega) x}\right\} \\ &= \Re\left\{\frac{a - i \omega}{a^2 + \omega^2} \mathrm{e}^{ i \omega x} \mathrm{e}^{a x}\right\} \\ &= \frac{a}{a^2 + \omega^2} \cos(\omega x) \mathrm{e}^{ax} + \frac{\omega}{a^2 + \omega^2} \sin(\omega x) \mathrm{e}^{a x} \\ \end{split}$$ But if $$a$$ is not a real number then bringing $$\mathrm{e}^{a t}$$ into the $$\Re$$ isn't allowed. But we get the same answer. So if we try to compute the integral in this way it's an abuse of notation. It does work in this instance, and other simple cases like $$x \cos(\omega x) \mathrm{e}^{a x}$$. Because this sort of integrand appears in the Laplace Transform reasonably commonly, it might be useful to know when this sort of abuse will work, and when it breaks down. (Yes, it is possible to also just use the identity $$\cos(\omega x) = \frac1{2} \left( \mathrm{e}^{i \omega x} + \mathrm{e}^{-i \omega x} \right)$$ and while that's easier than the integration by parts, it's more involved than the abuse.) I asked around and most answers I got had to do with complex analysis and the idea of analytic continuation. If we have: $$f(x) cos(\omega x) \mathrm{e}^{a x}$$ Then if $$f(x)$$ is an real-analytic function on the domain of integration then this should be a valid abuse of notation. Is this correct? Or does it need to be complex analytic? Or am I completely off track?
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
FractalFusion wrote:
Warp wrote:
OmnipotentEntity wrote:
And the answer is yes. Because we know that lim(x->0) -x / x3 = -infinity. So we just need to set g(x) to -x and we set 1/ln(f(x)) = x3 which gives f(x) = exp(x-3)
That seems to indeed work.
The function f(x) given above does not have a (two-sided) limit as x->0. The one I came up with was f(x)=exp(-x-4), g(x)=x2, and a=0. In this case, f(x), g(x) and f(x)g(x) all have the (two-sided) limit 0 as x->0.
I had mentioned this, but because it was below the picture I guess it was overlooked. I had already known it wasn't a two-sided limit. But I had lobbed the question back to Warp to try to find the solution you found.
OmnipotentEntity wrote:
However, f(x)'s limit at 0 is not two sided. But I bet you can find an example where all limits are two sided armed with this method. (There's a simple example very close in form to the example I gave.)
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Warp wrote:
Is it possible to have two functions f(x) and g(x) such that lim(x->a) f(x) = 0, lim(x->a) g(x) = 0 lim(x->a) f(x)g(x) = 0 and f(x) is not just the constant 0 (nor reduces to the constant zero, ie. eg. "f(x)=x-x" would be too boring of an answer)?
We can transform lim(x->a) f(x)g(x) into lim(x->a) exp(g(x) / (1 / ln(f(x)))) which is a 0/0 indeterminate form. So we can ask is it possible to find a pair of functions such that lim(x->a) exp(g(x) / (1 / ln(f(x)))) = -infinity ? And the answer is yes. Because we know that lim(x->0) -x / x3 = -infinity. So we just need to set g(x) to -x and we set 1/ln(f(x)) = x3 which gives f(x) = exp(x-3) f(x)^g(x) However, f(x)'s limit at 0 is not two sided. But I bet you can find an example where all limits are two sided armed with this method. (There's a simple example very close in form to the example I gave.)
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Updating the Linux and/or MacOSX support is something I would like very much. It would make my life much easier.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Huh, that's too bad. I really enjoyed this movie.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Playing around with it, for x negative, it seems like any C will do, if you allow complex values in intermediate steps. In fact, if you allow complex values, any C will do for any value of x and you'll get back your (1 + sqrt(4x + 1))/2. Except of course for the special case where x = 0 and C = 0.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
FractalFusion wrote:
What does sqrt(x+sqrt(x+sqrt(x+sqrt(...)))) mean exactly? If you mean a0=C, ai=sqrt(x+ai-1), limit as i goes to infinity, then there are values of C for which ai converges to (1 + sqrt(4x + 1)) / 2 for any x>=-1/4.
That's fair. And I suppose in the case of x > 0 then the particular value of C = 0 will converge. I wonder what is the convergence criteria for any x. If x > 0 then even if C is very large and negative, the repeated square rooting will drag the arg back toward 0. I suppose this means that for x > 0 for the expression to converge places no requirements on C. If x = 0 then even if C is very large and negative, you'll get a pull to one. However, if C = 0 then you won't converge. So for x = 0, C can be any value except 0. For x negative, it's non-trivial and I need to finish up some work. So I'll either revisit it or someone else will.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Masterjun wrote:
FractalFusion wrote:
Note that the strategies above are optimal but it may be possible that they aren't unique, though my guess is that they are unique.
A quick question: Does optimal strategy in this context mean that there are no other strategies against it with an expected win rate of over 50%? Or am I misinterpreting this?
A good way to think about an optimal strategy is, if I'm playing an optimal strategy against you, then my strategy is setup such that every option you choose has an equal expected payoff. It doesn't mean that your win rate is any specific value. Just that you get the same, minimized win probability no matter which choice you pick.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Warp wrote:
OmnipotentEntity wrote:
You get a similar oxymoron if you substitute x = 0: 1 = sqrt(0 + sqrt(0 + ...)).
Does this mean that you can only say sqrt(x+sqrt(x+sqrt(x+sqrt(...)))) = (1 + sqrt(4x + 1)) / 2 , x > 0 In other words, the equality does not hold for x <= 0? If yes, at which point of the proof does one have to assert that x>0?
I already went over this. y = sqrt(x+sqrt(x+sqrt(x+...))) y = sqrt(x + y) Going from step 1 to 2 you have to assert that the expression converges, and then I go to show (in a loose, nonrigorous way actually, I take that back, my argument makes no fucking sense at all...) that the expression cannot converge for x < 0. This isn't a rigorous argument, because I didn't show that the expression actually does converge anywhere, but assuming it does then its domain is limited to [0, inf), and although I didn't actually show that it doesn't converge for x=0, I'm thinking it doesn't, so its domain of convergence is actually (0, inf). If you want to make it rigorous, I'll leave that to you. EDIT: Here's a second attempt at making the x < 0 cannot converge argument stick: I'm going to approach this from a sign standpoint. If you collect a bunch of is in the sqrts, then they have to all cancel when forming the final value. Which means arg(z) = n pi. If x > 0 then sqrt(-x) = i sqrt(x). sqrt(-x + sqrt(-x)) = i sqrt(x + i sqrt(x)) arg(i sqrt(x)) = pi/2 arg(x + i sqrt(x)) = arctan(sqrt(x)/x) = arctan(1/sqrt(x)) arg(i sqrt(x +i sqrt(x))) = pi/2 + arctan(1/sqrt(x))/2 arg(x + i sqrt(x +i sqrt(x))) = arctan( (pi + arctan(1/sqrt(x))) /2x) From here we can create a general expression. arg(sqrt(-x + sqrt(-x ...)) = w = arctan( (pi + arctan(w)) /2x) Note that we are assuming that the value converges here. If it does not converge, then the original expression does not converge. So this is a safe assumption. tan(w) = (pi + arctan(w))/2x From this we can get x != 0. And because in order for y to be real, w must be n pi, and tan(n pi) = 0 we can replace: 0 = (pi + arctan(n pi))/2x pi + arctan(n pi) = 0 arctan has a range of (-pi/2, pi/2) so pi + arctan(anything) !=0. Therefore, this equation has no solutions that give y with Im{y} = 0. Therefore, over the domain (-inf, 0], sqrt(x + sqrt(x ....)) cannot have a purely real value.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
@Fractal Fusion. Thank for doing this write up. I appreciate it. I've never seen a non-trivial game theory problem attacked before.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
y = sqrt(x+sqrt(x+sqrt(x+...))) y = sqrt(x + y) y^2 = x + y y^2 - y - x = 0 y = (1 + sqrt(4x + 1)) / 2 Going from step 1 to step 2 assumes that the function converges. You have to be careful with this sort of infinite regression. They aren't always well behaved. In this case, because we know that sqrt(a + b) is less than sqrt(a) + sqrt(b) (for a, b > 0), we know that sqrt(y) + sqrt(x) > sqrt(y + x). But if sqrt(x) is out of domain then this equality simply doesn't hold. And because we know that sqrt(y + x) = y it must have a value if the series is convergent. So the series must not be convergent over this domain. (Ignore this shit. Read my next post.) You get a similar oxymoron if you substitute x = 0: 1 = sqrt(0 + sqrt(0 + ...)).
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Warp wrote:
Everybody seems to get it, except me. What?
The registration system is tricky. You and I have been around long enough that we've never had to go through it.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
I'm not sure why Wolfram Alpha is complaining about that. x1/ln(x) = eln(x)*1/ln(x) = e where ln(x)/ln(x) makes sense (essentially, everywhere except x=0 and x=1). So it's pretty straight forward to prove that the limit of a constant function with point discontinuities is the value of that function. In fact, Mathematica has no problem with it.
Limit[x^(1/Log[x]), x -> 0]
e
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
I voted yes. Would love to see it in Gruefood Delight at least, because based on previous similar "weird goal" TAS submissions, this probably isn't going to be accepted.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
More info dump in no particular order. 0x80B3 is a function I'm calling DoStoredProcInBank1. There's also an entry point for Banks 2, 3, and 4 nearby (however, 3 and 4 are unused because there isn't a jump table for them.) At 0x18000 and 0x28000 there are jump tables for what I'm terming "stored procedures" for lack of better terminology. Essentially, this function allows the programmer to simply call a function from a different bank. Which, I'm not sure why this exists because JSL is a thing. There are 26 stored procedures in bank 1, and another 31 in bank 2. Bank 4 does have a (256 entry) table of addresses at 0x48000, but it seems to be pointing to data of some sort, rather than code. Essentially, the calling convention is: LDA $#7 ; or other valid offset JSL DoStoredProcInBank1 I don't think I've found instances where the table uses a data offset rather than a hard coded one. Which would give it an actual use case. But this was rather confusing to reverse, so I figured I'd document it. I don't know if this is a common thing in SNES games. Along a similar, but even more confusing vein, 0x80E9 contains a function that I'm calling JumpTableCalculate. It essentially modifies the return address on the stack using the argument passed in A, and performs a jump to it. The Jump table is stored immediately after the JSL to JumpTableCalculate. The code in the 0 block seems mostly concerned with input/output, rather than game logic. The function responsible for pulling room sprite data into memory is located at 0x18B84. Room sprite data being any enemies, npcs, bosses, doors, and maybe two other things that I haven't been able to determine. More on this later. Actually it seems to pull in a lot of information about the current room. Most of which I don't know. This function pulls data from 0x5B2DF. Each entry in this array is 0x38 bytes in size and it's simply memcpy'd to 0x7E0050. The offset to the sprite data within the array is 0x2B, and is a 3-byte long address. This winds up in 0x7B, which is why I had previously thought that's the RoomID (the RoomID turned out to be located at 0x7E048E). So, for instance, Atland (RoomID = 0) has it's sprite data located at 0x59552. Each entry is 9 bytes and has this structure:
00000000 RoomSpriteData  struc ; (sizeof=0x9)    ; XREF: .05:AtlandSpritesr
00000000                                         ; .05:ChapelSpritesr ...
00000000 Type:           .BYTE ?
00000001 ID:             .BYTE ?
00000002 XCoord:         .WORD ?
00000004 YCoord:         .WORD ?
00000006 Unknown1:       .BYTE ?
00000007 InitialStatus:  .BYTE ?
00000008 Unknown2:       .BYTE ?
00000009 RoomSpriteData  ends
InitialStatus is a bitfield, which interacts with several places. I haven't bothered to figure out exactly what it does, because it's always set the same for the same enemy. I don't know what the unknowns do. They set 0x54A and 0x55D respectively. The good news is we have positional information here. And a very stable, programmatic way of obtaining it for any room. Just need some tile data and I can make the maps I've wanted for so long. Current state of the art on the data in RAM for sprites (and Nasir)
wram:0500 StatusBitfield: .BYTE 0 ; (uninited)    ; DATA XREF: sub_18082:loc_180B2r
wram:0500                                         ; sub_18082+87r ...
wram:0501 StatusBitfield2?:.BYTE 0 ; (uninited)   ; DATA XREF: sub_18BD5+19w
wram:0501                                         ; sub_19125r ...
wram:0502 XCoord:         .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_183D8+25r
wram:0502                                         ; sub_183D8+50r ...
wram:0504 YCoord:         .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_183D8+7Cr
wram:0504                                         ; sub_183D8+A7r ...
wram:0506 byte_7E0506:    .BYTE 0 ; (uninited)    ; DATA XREF: sub_19BCE+102w
wram:0506                                         ; sub_19BCE+11Fw ...
wram:0507 byte_7E0507:    .BYTE 0 ; (uninited)    ; DATA XREF: SamsonXPosCheck+3Fw
wram:0507                                         ; sub_280EA+22w ...
wram:0508 byte_7E0508:    .BYTE 0 ; (uninited)    ; DATA XREF: sub_19BCE+105w
wram:0508                                         ; sub_19BCE+122w ...
wram:0509 byte_7E0509:    .BYTE 0 ; (uninited)    ; DATA XREF: SamsonXPosCheck+45w
wram:0509                                         ; sub_280EA+2Ew ...
wram:050A Unknown1:       .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_18D5E+Fr
wram:050A                                         ; sub_19B34+48r ...
wram:050C word_7E050C:    .BYTE 0,0 ; (uninited)  ; DATA XREF: DoDamage+4Dw
wram:050C                                         ; ProcessHit+F3w ...
wram:050E word_7E050E:    .BYTE 0,0 ; (uninited)  ; DATA XREF: DoDamage+53w
wram:050E                                         ; ProcessHit+FDw ...
wram:0510 AnimationFrames:.BYTE 0,0 ; (uninited)  ; DATA XREF: sub_18BD5+1Fw
wram:0510                                         ; DoDamage:loc_19260w ...
wram:0512 BumpAndHurtFrames:.BYTE 0 ; (uninited)  ; DATA XREF: sub_1A334+Cw
wram:0512                                         ; ProcessHit+221w ...
wram:0513 word_7E0513:    .BYTE 0,0 ; (uninited)  ; DATA XREF: ProcessHit+73w
wram:0513                                         ; sub_1A334+12w ...
wram:0515 word_7E0515:    .BYTE 0,0 ; (uninited)  ; DATA XREF: DoDamage+5Cw
wram:0515                                         ; sub_2BCE0+39w ...
wram:0517 unk_7E0517:     ; 0 .BYTE uninited & unexplored ; DATA XREF: DoDamage+62w
wram:0517                                         ; sub_28199+3Cw
wram:0518 SpriteType:     .BYTE 0 ; (uninited)    ; DATA XREF: sub_18184r
wram:0518                                         ; HandleBossDeathr ...
wram:0518                                         ; 0 = ?, 1 = NPC, 2 = Enemy, 3 = Boss, 4 = ?, 5 = Door
wram:0519 byte_7E0519:    .BYTE 0 ; (uninited)    ; DATA XREF: sub_183D8+4r
wram:0519                                         ; sub_18BD5+2Aw ...
wram:0519                                         ; Range 0-3 (Direction?)
wram:051A BinarySomething?:.BYTE 0 ; (uninited)   ; DATA XREF: sub_280EA+5r
wram:051A                                         ; sub_2D9BB+23w
wram:051B SpriteID:       .BYTE 0 ; (uninited)    ; DATA XREF: sub_18184:loc_181BBr
wram:051B                                         ; HandleBossDeath+7r ...
wram:051B                                         ; Enum depends on 0x0518 type.
wram:051C HitBoxID:       .BYTE 0 ; (uninited)    ; DATA XREF: IsCollidingWithInteractable:loc_1A414r
wram:051C                                         ; IsCollidingWithInteractable:loc_1A41Er ...
wram:051D Unknown2:       ; 0 .BYTE uninited & unexplored ; DATA XREF: sub_1A821+2Cw
wram:051D                                         ; sub_1A89B+24w ...
wram:051E unk_7E051E:     ; 0 .BYTE uninited & unexplored ; DATA XREF: sub_1A821:loc_1A86Fw
wram:051E                                         ; sub_1A7B5:loc_1A90Bw ...
wram:051F Tangible?:      .BYTE 0 ; (uninited)    ; DATA XREF: ProcessHit:loc_1A15Dr
wram:051F                                         ; ProcessHit+25w ...
wram:0520 HitPoints:      .BYTE 0,0 ; (uninited)  ; DATA XREF: DoDamage+3r
wram:0520                                         ; DoDamage+Aw ...
wram:0522 MagicPoints:    .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_19125+42r
wram:0522                                         ; sub_19749+4r ...
wram:0524 AttackStat:     .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_194F7+12w
wram:0524                                         ; sub_194F7+27r ...
wram:0526 DefenseStat:    .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_1952F+12w
wram:0526                                         ; sub_1952F+23r ...
wram:0528 GoldAmount:     .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_1947Ar
wram:0528                                         ; sub_1947A+7w ...
wram:052A ExperienceAmount:.BYTE 0,0 ; (uninited) ; DATA XREF: sub_194B2r
wram:052A                                         ; sub_194B2+7w ...
wram:052C LevelOrEnemyState:.BYTE 0,0 ; (uninited) ; DATA XREF: sub_194B2:loc_194CDr
wram:052C                                         ; sub_194B2+33w ...
wram:052E word_7E052E:    .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_19592:loc_19600r
wram:052E                                         ; sub_19592+7Aw ...
wram:0530 word_7E0530:    .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_194F7+6r
wram:0530                                         ; sub_1A89B+45r ...
wram:0532 word_7E0532:    .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_18934+25r
wram:0532                                         ; sub_1952F+1Er ...
wram:0534 word_7E0534:    .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_2B2F6:loc_2B85Aw
wram:0534                                         ; sub_2B8BA+8r ...
wram:0536 word_7E0536:    .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_19008r
wram:0536                                         ; sub_19008+8r ...
wram:0538                 ; 0 .BYTE uninited & unexplored
wram:0539 unk_7E0539:     ; 0 .BYTE uninited & unexplored ; DATA XREF: sub_2C797+1D3w
wram:053A                 ; 0 .BYTE uninited & unexplored
wram:053B unk_7E053B:     ; 0 .BYTE uninited & unexplored ; DATA XREF: sub_2C797+1D9w
wram:053C                 ; 0 .BYTE uninited & unexplored
wram:053D                 ; 0 .BYTE uninited & unexplored
wram:053E word_7E053E:    .BYTE 0,0 ; (uninited)  ; DATA XREF: sub_18BD5+22w
wram:053E                                         ; sub_19170+5r ...
There's a lot of unknowns here, but the good news is I have multiple code references for every entry. So figuring out any specific entry should be doable. These should be more or less self-explanatory, "Tangible?" is used by Battler to determine whether or not he can hit or be hit. It probably has more uses than just that. HitboxID is used by Natela and Samson and... no other enemy at all. Because these two enemies have animations where they move and walk around, they have differently sized hitboxes depending on their actions. You can see this in action in the hitbox code at 0x1A3DF, Samson's switch case is at 0x1A414, Natela's at 0x1A41E, for the rest of the cases they simply load an offset (except Battler, who does that aforementioned check to see if he even has a hitbox.) The boss hitboxes are stored here:
.01:FCEF                 Hitbox <28> ; Samson Swing Frame #1
.01:FCF7                 Hitbox <32> ; Samson Swing Frame #2
.01:FCFF                 Hitbox <24> ; Samson Idle
.01:FD07                 Hitbox <24> ; Samson Jump
.01:FD0F                 Hitbox <18> ; Natela Walk Frame #1
.01:FD17                 Hitbox <18> ; Natela Walk Frame #2
.01:FD1F                 Hitbox <24> ; Natela Idle
.01:FD27                 Hitbox <24> ; Natela Fire Breath
.01:FD2F                 Hitbox <18> ; Natela Rush #1
.01:FD37                 Hitbox <18> ; Natela Rush #2
.01:FD3F                 Hitbox <18> ; Natela Rush #3
.01:FD47                 Hitbox <40> ; Eardon
.01:FD4F                 Hitbox <1C> ; Duma
.01:FD57                 Hitbox <18> ; Duma Hands
.01:FD5F                 Hitbox <20> ; Thimale
.01:FD67                 Hitbox <14> ; Battler
.01:FD6F                 Hitbox <1A> ; Battler Eggs
.01:FD77                 Hitbox <20> ; Evil Spirit (Green and Red)
.01:FD7F                 Hitbox <14> ; Thor (Human)
.01:FD87                 Hitbox <30> ; Thor (Bird)
.01:FD8F                 Hitbox <10> ; Thor (Red Shield Balls)
.01:FD97                 Hitbox <10> ; Ella
Doors and NPCs all have the exact same hitboxes. These are static constants in code inside of the hitbox generating routine. At 0x29574 there is a gargantuan subroutine, that I believe MIGHT be the Sprite update routine (that is to say, enemy and NPC AI). However, navigating it so far has been difficult (because it's a switch on 6 cases for the SpriteType, which lead to a switch on the SpriteID of 16, 39, and 90 options for bosses, enemies, and npcs respectively...). I'll give it more of a go later on. I just discovered it today. At 0x292B2 there seems to be some sinusoidal looking data that's referenced by a chunk of code related to Thor Bird. I was thinking it might have something to do with movement. At memory location 0x7E0393 there seems to be a counter which might be related to Samson's idle timer. Which should help with the boss fight if I can figure out where it gets set. Nasir's stats by level in data are stored at offset 0x1E068. But I lost the code offset due to sloppiness. I'll find it again eventually. Enemy stats, on the other hand, are stored at 0x591AB. At this address there's a list of addresses to the actual structure data. The first enemy is at 0x591F9. Boss stats follow immediately after at 0x59442, with the first boss at 0x59462. The structure's layout is:
00000000 EnemyStatsByType struc ; (sizeof=0xF)   ; XREF: .05:91F9r
00000000                                         ; .05:stru_59462r
00000000 field_0:        .BYTE ?
00000001 HP:             .WORD ?                 ; base 10
00000003 MP:             .WORD ?                 ; base 10
00000005 Attack:         .WORD ?                 ; base 10
00000007 Defense:        .WORD ?                 ; base 10
00000009 Gold:           .WORD ?                 ; base 10
0000000B Experience:     .WORD ?                 ; base 10
0000000D State:          .WORD ?
0000000F EnemyStatsByType ends
I don't know what field_0 is, but it gets placed into 0x7E055A (The BinarySomething? field.)
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
r57shell wrote:
FractalFusion wrote:
Indeed, g(x)=x+f(x), and so g(d+1)-g(d)=1+f(d+1)-f(d).
Тhis works only for x from Z (integer).
Given g(x) = x+f(x) with x ∈ ℝ. We have by simple substitution: g(d) = d + f(d) g(d+1) = d + 1 + f(d+1) Now subtract the first line from the second: g(d + 1) - g(d) = d + 1 + f(d+1) - (d + f(d)) Simplify: g(d + 1) - g(d) = d + 1 + f(d+1) - d - f(d) g(d + 1) - g(d) = d - d + 1 + f(d+1) - f(d) g(d + 1) - g(d) = 1 + f(d+1) - f(d) QED. Considering that g is defined to have a domain of ℝ, nothing in these steps requires d ∈ ℤ.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
If anyone else wants to investigate the sequence, but doesn't want to generate a bunch of numbers themself. Here're the first 1e7. (555kB gzipped, 47MB raw) http://fixed.space/files/10tothe7.txt.gz I've got the first billion running on my beefier computer. Should be done in about a day?
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
An approximate fit for the upper bound (not strict, more of a theta than a big o) seems to be sqrt(x) + sqrt(sqrt(x)), no idea why.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Bobo the King wrote:
Is the blue area x(n) while the green line is sqrt(n) + ln(n)?
It is.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Experienced Forum User, Published Author, Player (36)
Joined: 9/11/2004
Posts: 2624
Good eye Bobo, Here is the sequence graphed with what seems to be both a valid lower bound of sqrt(x) and a valid upper bound of sqrt(x) + ln(x). The upper bound fails for x < 3 (which are oddball anyway.) (Click for larger) The upper bound of ln(x) does not hold.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.