User:Rupert

From The Urban Dead Wiki
Revision as of 05:31, 20 April 2009 by Rupert (talk | contribs) (→‎Mall)
Jump to navigationJump to search

I am a stats junkie. I wrote my own Javascript/PHP page that scrapes search results from the HTML as I play Urban Dead.

News

The odds of finding a syringe are back up to 13%. Generators don't make any difference. I added Confidence Intervals to my data. Consider the binomial likelihood function: L = (n choose y) * p^(y) * (1-p)^(n-y), where n is the number of searches, y is the number of successes, p is the predicted search rate and L is the likelihood that the predicted search rate is correct. To compute the 50% confidence interval I throw away the first and last 25% of the area under the curve. This interval contains 50% of the likelihood. If p=10% and the 50% confidence interval is -1/+2 then there is a 50% chance the true search rate is in the interval 9% to 12%. --Rupert 03:02, 12 April 2009 (BST)


Latest

These results were collected starting April '09 or so. --Rupert 02:48, 12 April 2009 (BST)

By Building

building_type cond lights searches item count percent 50%
confidence
90%
confidence
AP
auto repairokaylit684nothing51975.9%-1.1/+1.1%-2.8/+2.6%1.3
spray can405.8%-0.5/+0.7%-1.3/+1.6%17.2
fuel can405.8%-0.5/+0.7%-1.3/+1.6%17.2
crowbar345.0%-0.6/+0.6%-1.3/+1.5%20.0
bottle of beer162.3%-0.3/+0.5%-0.8/+1.1%43.5
fire axe162.3%-0.3/+0.5%-0.8/+1.1%43.5
toolbox111.6%-0.3/+0.4%-0.7/+0.9%62.5
newspaper81.2%-0.3/+0.3%-0.6/+0.8%83.3
dark273nothing21578.8%-1.7/+1.6%-4.3/+3.8%1.3
fuel can165.9%-1.0/+1.0%-2.1/+2.6%16.9
spray can155.5%-0.9/+1.0%-2.0/+2.6%18.2
crowbar155.5%-0.9/+1.0%-2.0/+2.6%18.2
newspaper51.8%-0.5/+0.6%-1.0/+1.7%55.6
toolbox41.5%-0.5/+0.5%-0.9/+1.5%66.7
fire axe31.1%-0.4/+0.5%-0.8/+1.4%90.9
factoryokaylit536nothing39774.1%-1.3/+1.2%-3.2/+3.0%1.3
length of pipe376.9%-0.7/+0.8%-1.7/+2.0%14.5
fuel can275.0%-0.6/+0.7%-1.4/+1.7%20.0
toolbox234.3%-0.6/+0.6%-1.3/+1.6%23.3
crowbar193.5%-0.5/+0.6%-1.1/+1.5%28.6
portable generator183.4%-0.5/+0.5%-1.2/+1.4%29.4
fire axe152.8%-0.5/+0.5%-1.0/+1.3%35.7
hospitalokaylit2012nothing150574.8%-0.7/+0.7%-1.6/+1.6%1.3
first-aid kit50725.2%-0.7/+0.7%-1.6/+1.6%4.0
dark1410nothing113080.1%-0.7/+0.8%-1.7/+1.8%1.2
first-aid kit28019.9%-0.8/+0.7%-1.8/+1.7%5.0
necrotechokaylit488nothing37576.8%-1.3/+1.3%-3.2/+3.1%1.3
syringe6513.3%-1.0/+1.1%-2.4/+2.7%7.5
DNA extractor275.5%-0.6/+0.8%-1.5/+1.9%18.2
GPS unit214.3%-0.6/+0.7%-1.3/+1.7%23.3
dark458nothing36579.7%-1.3/+1.2%-3.2/+3.0%1.3
syringe5912.9%-1.0/+1.1%-2.4/+2.7%7.8
GPS unit194.1%-0.6/+0.7%-1.3/+1.8%24.4
DNA extractor153.3%-0.6/+0.6%-1.2/+1.5%30.3
ruineddark53nothing4788.7%-3.2/+2.7%-8.4/+5.8%1.1
syringe47.5%-2.2/+2.7%-4.5/+7.5%13.3
GPS unit11.9%-1.1/+1.7%-1.7/+5.2%52.6
DNA extractor11.9%-1.1/+1.7%-1.7/+5.2%52.6
police deptokaylit552nothing40974.1%-1.3/+1.2%-3.1/+3.0%1.3
shotgun shell437.8%-0.8/+0.8%-1.8/+2.0%12.8
pistol clip376.7%-0.7/+0.7%-1.6/+1.9%14.9
pistol162.9%-0.5/+0.5%-1.0/+1.3%34.5
flare gun142.5%-0.4/+0.5%-0.9/+1.3%40.0
shotgun122.2%-0.4/+0.4%-0.9/+1.2%45.5
flak jacket112.0%-0.4/+0.4%-0.8/+1.1%50.0
radio101.8%-0.3/+0.4%-0.8/+1.1%55.6
dark519nothing42181.1%-1.2/+1.2%-2.9/+2.7%1.2
pistol clip336.4%-0.7/+0.7%-1.7/+1.9%15.6
shotgun shell265.0%-0.6/+0.7%-1.4/+1.7%20.0
shotgun91.7%-0.3/+0.5%-0.8/+1.2%58.8
flare gun91.7%-0.3/+0.5%-0.8/+1.2%58.8
pistol81.5%-0.3/+0.4%-0.7/+1.1%66.7
radio71.3%-0.3/+0.4%-0.6/+1.1%76.9
flak jacket61.2%-0.3/+0.3%-0.7/+0.9%83.3
streets--1nothing199.9%-29.3/+0.0%-68.4/+0.1%1.0

--Rupert 06:30, 20 April 2009 (BST)

Mall

building_type cond lights bargain searches item count percent 50%
confidence
90%
confidence
AP
mall_drug_storeokaylitbargain907nothing75483.1%-0.8/+0.9%-2.1/+2.0%1.2
first-aid kit15316.9%-0.9/+0.8%-2.0/+2.1%5.9
no bargain913nothing82990.8%-0.7/+0.6%-1.7/+1.5%1.1
first-aid kit849.2%-0.6/+0.7%-1.5/+1.7%10.9
mall_gun_storeokaylitbargain208nothing10851.9%-2.3/+2.3%-5.7/+5.7%1.9
pistol clip3717.8%-1.7/+1.8%-4.1/+4.6%5.6
shotgun shell3315.9%-1.7/+1.7%-3.9/+4.4%6.3
shotgun188.7%-1.3/+1.3%-2.9/+3.5%11.5
pistol125.8%-1.1/+1.1%-2.3/+3.0%17.2
no bargain254nothing18773.6%-1.9/+1.9%-4.7/+4.4%1.4
pistol clip239.1%-1.2/+1.2%-2.7/+3.2%11.0
shotgun shell218.3%-1.1/+1.2%-2.6/+3.1%12.0
shotgun155.9%-0.9/+1.1%-2.1/+2.8%16.9
pistol83.1%-0.6/+0.9%-1.4/+2.2%32.3
mall_tech_storeokaylitno bargain39nothing3282.1%-4.4/+3.8%-11.3/+8.4%1.2
radio37.7%-2.6/+3.2%-5.1/+9.0%13.0
radio transmitter37.7%-2.6/+3.2%-5.1/+9.0%13.0
mobile phone12.6%-1.4/+2.2%-2.4/+6.9%38.5

--Rupert 06:31, 20 April 2009 (BST)

Result Set 2

User:Rupert/Results2

Result Set 1

User:Rupert/Results1

Methods

I play every page of Urban Dead through a Javascript page on my home computer that I coded up using the Prototype Javascript library (awesome) that uses AJAX HttpRequests to a php proxy (super awesome). That's because Javascript can't contact urbandead.com directly due to the security sandbox, but it can contact php on the same machine and php can contact any website it wishes, so it's more of a two-level proxy, sometimes three. I can then over-analyze the HTML with Javascript till my heart's content, extracting all sorts of information, as well as auto-searching (a fire-and-forget time saver). Javascript is surprisingly good at this and fun to program.

Each search result scraped by Javascript is sent via another AJAX request to a similar php page that stores the data in a MySQL table with these columns:

+--------------------+---------------------+------+-----+---------+-------+
| Field              | Type                | Null | Key | Default | Extra |
+--------------------+---------------------+------+-----+---------+-------+
| name               | char(25)            | NO   |     |         |       |
| date               | date                | YES  |     | NULL    |       |
| building_name      | char(40)            | NO   |     |         |       |
| building_type      | char(20)            | NO   |     |         |       |
| inside             | tinyint(3) unsigned | NO   |     |         |       |
| building_condition | char(10)            | NO   |     |         |       |
| building_light     | tinyint(3) unsigned | NO   |     |         |       |
| has_shopping       | tinyint(3) unsigned | NO   |     |         |       |
| has_bargain        | tinyint(3) unsigned | NO   |     |         |       |
| item_found         | char(40)            | NO   |     |         |       |
| has_necro          | tinyint(3) unsigned | NO   |     | 0       |       |
| has_necro_lab      | tinyint(3) unsigned | NO   |     | 0       |       |
+--------------------+---------------------+------+-----+---------+-------+

When I'm done playing, I run a SQL script that copies that data into a temporary table, transforming all items named "pistol(*)" to just "pistol" because I don't care about the odds of pistol ammo right now, same for "shotgun(*)". Then I transform "NecroTech syringe" and "revivification syringe" into just "syringe", "rusty knife" and "pocket knife" and "hunting knife" into just "knife". Then I count identical rows. This condenses the table from thousands of rows (one per search) to only hundreds, at which point it looks like this:

+-------------+----+-----------+-------+----------+---------+-------+-----+----------------+-------+
| building    | in | condition | light | shopping | bargain | necro | lab | item           | count |
+-------------+----+-----------+-------+----------+---------+-------+-----+----------------+-------+
| auto repair |  1 | okay      |     1 |        0 |       0 |     1 |   1 | bottle of beer |     2 |
| auto repair |  1 | okay      |     1 |        0 |       0 |     1 |   1 | crowbar        |     1 |
| auto repair |  1 | okay      |     1 |        0 |       0 |     1 |   1 | fire axe       |     1 |
| auto repair |  1 | okay      |     1 |        0 |       0 |     1 |   1 | fuel can       |     4 |
| auto repair |  1 | okay      |     1 |        0 |       0 |     1 |   1 | nothing        |    34 |
| auto repair |  1 | okay      |     1 |        0 |       0 |     1 |   1 | spray can      |     3 |
| auto repair |  1 | okay      |     1 |        1 |       0 |     0 |   0 | bottle of beer |     1 |
| auto repair |  1 | okay      |     1 |        1 |       0 |     0 |   0 | crowbar        |     3 |
| auto repair |  1 | okay      |     1 |        1 |       0 |     0 |   0 | fire axe       |     1 |
| auto repair |  1 | okay      |     1 |        1 |       0 |     0 |   0 | fuel can       |     2 |
+-------------+----+-----------+-------+----------+---------+-------+-----+----------------+-------+

Then the script builds up a second temporary table populated by three queries on the first temp table:

  1. all non-mall and non-necrotech rows grouped by building type, light, and item
  2. all malls and mall substores further grouped by has_shopping and has_bargain
  3. all necrotechs grouped by the same as (1) but also by has_necro and has_lab (because the odds appear to be different)

Then I order the table by building and condition to get the "By Building" table, and by item for the "By Item" table. Then I execute a php page to get the html tables to paste into this lovely wiki.