Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old October 28, 2010, 19:13   #21
Omnipact
Rookie
 
Join Date: Jun 2007
Location: Bristol, UK
Posts: 23
Omnipact is on a distinguished road
Quote:
Originally Posted by Nate View Post
After some hunting, mostly in the object folder, I can't find the pval calculation stuff in the source. I'm assuming this is where the chart Derakon mentions is located. Any leads?
Have a look at z-rand.c
Omnipact is offline   Reply With Quote
Old October 28, 2010, 19:23   #22
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,448
Derakon is on a distinguished road
Okay, from my reading of the actual code for m_bonus, it appears to be trying to generate a normal distribution with average value (max bonus * item level / 128) and standard deviation of (max value / 4). There's a lot of weird stuff in there to approximate floating point with integer math, but I believe that's broadly accurate. And of course, values are clamped to be between 0 and the max value.

Incidentally, I found this code by starting from the documentation in object.txt, which says:
Code:
# Some fields accept randomized numbers of the form "10+2d3M4" where
# 10 is the non-variable base, 2d3 is a standard die roll, and
# M4 uses the m_bonus function to generate a number between 0 and
# 4 according to a normal distribution.
From there, it's fairly straightforward to find the definition of m_bonus in the source code.
Derakon is offline   Reply With Quote
Old October 28, 2010, 19:47   #23
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
[edit] deleted my post, I read the wrong entry
PowerDiver is offline   Reply With Quote
Old October 28, 2010, 22:53   #24
Nate
Rookie
 
Join Date: Mar 2010
Posts: 19
Nate is on a distinguished road
Is the item level the level on which the item is found?

If so, for a ROS at DL 128 the m5 enchantment should be a random # drawn from a normal distribution with mean = (5*128)/128 = 5 and std dev = 5/4 = 1.25

When I run this 1000 times in Excel using this function I found on the internet: =NORMINV(RAND(),5,1.25), I get 64.5% with a bonus of 5 or more.

For the Amulet of the Magi, I calculated means for the normal distribution of the following:

DL 50 = (3*50)/128 = 1.171875
DL 100 = (3*100)/128 = 2.34375
DL128 = (3*128)/128 = 3

Standard Deviation for each is 3/4 = .75

For 1000 random numbers these are the precentages I found for an Amulet of the Magi getting a +4 enchantment:

DL50 = 0%
DL100 = 7.1%
DL128 = 51.1%

0% doesn't mean it is impossible, just for that this run of 1000 numbers, none achieved the max enchantment at DL50.
Nate is offline   Reply With Quote
Old October 28, 2010, 23:06   #25
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,448
Derakon is on a distinguished road
Quote:
Originally Posted by Nate View Post
Is the item level the level on which the item is found?
Only if the item is found on the floor outside of a vault. Items dropped by monsters use max(monster level, avg(monster level, dungeon level)), items dropped by chests use a hardcoded value depending on the type of chest, items in vaults get a boost applied to them depending on where they are in the vault, etc.
Derakon is offline   Reply With Quote
Old October 28, 2010, 23:08   #26
Nate
Rookie
 
Join Date: Mar 2010
Posts: 19
Nate is on a distinguished road
If I'm doing everything correctly, chances of getting a ROS +23 at DL 128 IF the maximum of 10 is achieved from the d5m5 calculation are:

1/5(chances that rolling a 5 sided die results in a 5)*1/64.5(chances that the random number generated from the normal distribution with mean 5 std dev 1.25 is a 5)*1/8192(13 consecutive coin flips of the same result) = 1 in 2,641,920. To this must be added the chances of getting to +23 from each of the other possible results of the d5m5 check (1 through 9). This shouldn't add much to the total because the number of consecutive same coin flips required increases and those chances are small.
Nate is offline   Reply With Quote
Old October 28, 2010, 23:53   #27
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
Quote:
Originally Posted by Derakon View Post
Only if the item is found on the floor outside of a vault. Items dropped by monsters use max(monster level, avg(monster level, dungeon level)), items dropped by chests use a hardcoded value depending on the type of chest, items in vaults get a boost applied to them depending on where they are in the vault, etc.
Nate is playing 312v2, which I believe uses max(monster level, dungeon level) before boosts.
PowerDiver is offline   Reply With Quote
Old October 28, 2010, 23:58   #28
Nate
Rookie
 
Join Date: Mar 2010
Posts: 19
Nate is on a distinguished road
Nope, I didn't do everything correctly. +23 is not nearly that rare. I was counting 64.5% as 1/64.5, not 64.5/100. The revised chances for ROS +23 at DL128 are approx. 1 in 26702.

The numbers for the Amulet of the Magi should be correct. Sorry! I'm actually surprised we haven't seen higher then +23 with all the players out there (+24 is about 1 in 53407).

Last edited by Nate; October 29, 2010 at 15:06.
Nate is offline   Reply With Quote
Old October 29, 2010, 00:07   #29
Nate
Rookie
 
Join Date: Mar 2010
Posts: 19
Nate is on a distinguished road
My new number includes the chances for all the possible values (1-10) of the d5m5 calculation, i.e. d5m5=10, consecutive coin flips=13; d5m5=9, consecutive coin flips=14, and so on down to d5m5=1, consecutive coin flips=22. The addition of these contributed more than I expected to the total chances.
Nate is offline   Reply With Quote
Old October 29, 2010, 00:10   #30
Nate
Rookie
 
Join Date: Mar 2010
Posts: 19
Nate is on a distinguished road
And as it appears that the item level used in the m_bonus function is not necessarily simply the level on which the item is found, my calculation would only apply to ROS lying on the dungeon floor not in a vault. Yikes.
Nate is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stealth or speed? Sirridan Vanilla 6 March 11, 2010 05:33
Target in range indicator? ChodTheWacko Vanilla 1 November 28, 2009 16:14
r1487 - Stats values randomly exchanged. marteo Vanilla 5 July 15, 2009 04:34
Now that I have speed, what to do? Big Al AAR 3 September 22, 2008 19:49
Speed Zero Vanilla 9 January 9, 2008 02:21


All times are GMT +1. The time now is 22:47.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.