Source talk:NetHack 3.4.3/src/allmain.c

From NetHackWiki
(Redirected from Source talk:Allmain.c)
Jump to: navigation, search

The comment under the section on lava (line 274) says kill the player after three turns, but this does not seem to match the code. The counter u.utrap is setup in the routine lava_effects trap.c#line3991 as rn1(4, 4) + (rn1(4, 12) << 8). It is then decremented by 1<<8 and incremented by rnd(4) each turn until it is less than 1<<8. Since rn1(x,y) returns a number from y to y + x - 1 and x << y is equivalent to x * (2 ^ Y) u.utrap starts between 3076 and 3847, and is decreased by 253 to 256 each turn. This means you would be stuck in the lava from 13 to 16 turns before dying. Can someone confirm this or tell me where my analysis is off? Skidragon 16:20, 6 July 2009 (UTC)