Talk:Ice

From NetHackWiki
Jump to navigation Jump to search

Melting ice

The way the timeout is determined is kinda odd, so I don't know what the actual probabilities are. If I'm not misreading the source:

  • Timer is initialized to 50 (MIN_ICE_TIME) if not already set. It's already set if this is an ice bolt travelling over existing (thawing) ice rather than plain water.
  • There is a 1 in 2000 (MAX_ICE_TIME) chance that the current duration of 50 will be used as the duration.
  • If this is not the case, increment the duration. There is a 1 in 1999 chance that the current duration (51) will be used.
  • And so on; up to 1950 trials of "1 in (2000 - duration + 50)", with the final one being "1 in 50"
  • If none of these trials pass, the ice is made permanent.

-- Qazmlpok (talk) 19:07, 3 January 2016 (UTC)

If that is correct, the chance of permanent ice forming after one zap is 1999/2000 * 1998/1999 * 1997/1998 * ... * 50/51 * 49/50 = 49/2000 (about 2.5% chance), and the chance of duration being N is 1999/2000 * 1998/1999 * ... * (2050-N)/(2051-N) * 1/(2050-N) = 1/2000, exactly the same for each N. However, each subsequent zap will start with higher duration, so the chances of permanent ice should improve quickly with several zaps. After two zaps, the chance is already 49/2000 * (H(2000) - H(49) + 1) [H(n) being harmonic numbers], which is about 11.5%. For three zaps the calculation becomes slightly complicated, but Wolfram|Alpha gives about 28.3% chance for permanent ice. I'm too lazy to calculate further, but you get the idea. Tomsod (talk) 14:50, 11 July 2018 (UTC)
Returning to this, I just recalculated the chances of permanent ice (I gave slightly wrong figures before). For one zap it's 2.45%, for two, 11.56%, for three, 28.48%, and for four I just calculated a 49.61% chance, although it's approximate and I'm not sure all four digits are significant. Perhaps I should add it to the article. Tomsod (talk) 19:58, 8 January 2020 (UTC)