Remove Advertisements

thecks matlab code, making it easier to setup

Warning: Theorycraft inside.

Moderators: Fridmarr, Worldie, Aergis, theckhd

thecks matlab code, making it easier to setup

Postby SplashyTanks » Fri Jul 10, 2009 10:22 pm

Updated July 15/09, 2nd release of code

Hello,

I was looking through thecks code and realized it can be time consuming to fill out all the data needed in the my_gear file. This is especially true if you are comparing different tanks. So I put together an armor scraper in python that will grab your character and convert the data in to a form that thecks mattlab code can use.

Files:
armoryscraper.py - this is used to download and parse the armory info
tankadin.py - converts armory data in to a format readable by thecks code
unique.py - mostly contains IDs and hashes
example.py - run it!

incomplete
boss.py - module for building boss profiles
ttlengine.py - time to live engine



You will need to install the latest version of python (http://www.python.org/download/releases/2.6/) to run it. Stay away from python 3.0, i think its still in its testing phase. If you do not have python an exe is included in the dist directory but you will need to haveMicrosoft Visual C++ 2008 redistributable package(http://www.microsoft.com/downloads/deta ... laylang=en) to use it. The exe works with vista, havent tried xp yet. If you have a *nix system you shouldn't need a binary. Nearly all *nix systems come with python.

If you want to run the code via python just do:
Code: Select all
python example.py


If you don't have python just open up the exe found in the dist directory

You will be prompted to enter information and if you want to save the data.

The hope is that this will be extended to use more of thecks mattlab code and eventually evolve in to a time to live engine with threat analysis.

Hehe, python 3 was released over 8 months ago
But indeed get 2.6 as 3 will give some issues depending on the code(little backwards compatibilty)


oops :oops:
Either way, you will want to avoid using 3.0. The code has not been tested with that yet.

All the code is released under the GPL.

http://splashytanksarmoryscraper.google ... craper.rar

Current Progress
-gear support
works
-gem support
works
-enchant support
needs to be coded

Here is what the output looks like
Code: Select all
Crit_Meta_gemmed=0;
BV_Meta_gemmed=0;
Armsman_enchanted=1

T72pc_equipped=1;
T72pc=1+0.1*T72pc_equipped;

T82pc_equipped=0;
T82pc=1+0.1*T82pc_equipped;
T84pc_equipped=0;
T84pc=225*T84pc_equipped;

%START GEAR SECTION

%Item   = [STR STA AGI INT SPI Hit Crit Exp AP SP Haste ArP Def Dod]
Helm = [68 126 0 0 0 0 0 36 0 0 0 0 59 0 56 0 0 1867];
Chest = [84 126 0 0 0 0 0 0 0 0 0 0 67 0 49 0 39 2298];
Gloves = [84 115 0 0 0 0 0 0 0 0 0 0 45 0 36 68 0 1467];
Legs = [100 127 0 0 0 0 0 0 0 0 0 0 54 0 0 54 52 2011];
Shoulder = [68 100 0 0 0 0 0 0 0 0 0 0 40 37 39 0 0 1723];
Bracers = [46 94 0 0 0 36 0 0 0 0 0 0 39 44 0 0 0 1027];
Belt = [84 103 0 0 0 0 0 0 0 0 0 0 36 45 37 0 0 1321];
Boots = [85 103 0 0 0 0 0 0 0 0 0 0 37 44 37 0 0 1614];
Back = [41 84 0 0 0 32 0 0 0 0 0 0 38 37 0 0 0 154];
Ring1 = [63 94 0 0 0 0 0 0 0 0 0 0 33 0 0 51 32 0];
Ring2 = [38 84 0 0 0 27 0 21 0 0 0 0 56 0 0 0 0 0];
Trink1 = [0 111 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
Trink2 = [0 63 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
Shield = [42 94 0 0 0 28 0 28 0 0 0 0 63 0 0 221 0 7890];
Weapon = [35 69 0 0 0 0 0 23 0 0 0 0 26 34 0 0 0 0];
weapon_base_dps=163.24;
weapon_base_speed=1.7;
Neck = [42 94 0 0 0 42 0 0 0 0 0 0 41 43 0 0 0 0];
%END OF GEAR SECTION

%START GEM SECTION

HelmGems = [0 12 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0];
ChestGems = [0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
GlovesGems = [0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
LegsGems = [0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
ShouGems = [0 24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
BracGems = [0 24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
BeltGems = [0 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
BootGems = [0 65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
BackGems = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
Rin1Gems = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
RingGems = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
ShieGems = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
WeapGems = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
NeckGems = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
%END OF GEM SECTION

%START ENCHANTS SECTION

HelmEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
ChesEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
GlovEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
LegsEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
ShouEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
BracEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
BeltEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
BootEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
BackEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
Rin1Ench = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
Rin2Ench = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
ShieEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
WeapEnch = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
%END OF ENCHANTS SECTION


%% Total Contributions from Gear, Gems, and Enchants

Gear = [Helm; Neck; Shoulder; Back; Chest; Bracers; Gloves; Belt; Legs; Boots; Ring1; Ring2; Trink1; Trink2; Weapon; Shield];
Gems = [HelmGems; NeckGems; ShouGems; BackGems; ChesGems; BracGems; GlovGems; BeltGems; Legs
s; BootGems; Rin1Gems; Rin2Gems; WeapGems; ShieGems];
Enchants = [HelmEnch; ShouEnch; BackEnch; ChesEnch; BracEnch; GlovEnch; BeltEnch; LegsEnch; BootEnch; Rin1Ench; Rin2Ench; WeapEnch; ShieEnch];

Gear_Total=sum(Gear)+sum(Gems)+sum(Enchants);
%Item   = [STR STA AGI INT SPI Hit Crit Exp AP SP Haste ArP Def Dod Parr BV BR Armor]
Gear_STR=Gear_Total(1);
Gear_STA=Gear_Total(2);
Gear_AGI=Gear_Total(3);
Gear_INT=Gear_Total(4);
Gear_SPI=Gear_Total(5);
Gear_Hit=Gear_Total(6);
Gear_Crit=Gear_Total(7);
Gear_Exp=Gear_Total(8);
Gear_AP=Gear_Total(9);
Gear_SP=Gear_Total(10);
Gear_Haste=Gear_Total(11);
Gear_ArP=Gear_Total(12);
Gear_Defense=Gear_Total(13);
Gear_Dodge=Gear_Total(14);
Gear_Parry=Gear_Total(15);
Gear_BV=Gear_Total(16);
Gear_BR=Gear_Total(17);
Gear_Armor=Gear_Total(18);





If there are any suggestions or features anyone would like to see let me know.
Last edited by SplashyTanks on Wed Jul 15, 2009 8:34 pm, edited 4 times in total.
SplashyTanks
 
Posts: 8
Joined: Sat Aug 16, 2008 2:56 pm

Re: thecks mattlab code, making it easier to setup

Postby Pizbit » Sat Jul 11, 2009 5:36 am

Hehe, python 3 was released over 8 months ago :D
But indeed get 2.6 as 3 will give some issues depending on the code(little backwards compatibilty)
I have ADHD and OCD...I keep forgetting to wash my hands.
Pizbit
 
Posts: 2184
Joined: Fri Aug 10, 2007 11:37 am

Re: thecks matlab code, making it easier to setup

Postby SplashyTanks » Tue Jul 14, 2009 4:43 pm

Here is my code for simulating rolls. Not sure if im doing it right. any input would be awesome. Looks like the above code will be extended in to a time to live engine.
Code: Select all
#we assume you will always be uncritable
class attacktable:
    def __init__(self, miss, dodge, parry, block):
        self.miss = miss - 0.6
        self.parry = parry - 0.6
        self.dodge = dodge - 0.6
        self.block = block + 30 - 0.6 #assume holy shield
        self.hit = 100.0 - miss - parry - dodge - block


    def ReCalculate(self):
        #do we get hit at all?
        hittable = self.block + self.parry + self.dodge + self.miss
        if hittable >=100:
            self.hit = 0
            self.block = 100 - self.parry - self.dodge - self.miss
        else:
            self.hit = 100.0 - self.miss - self.parry - self.dodge - self.block

    def Roll(self):
        myRoll = random.uniform(0.0,1.0) * 100
        if myRoll >= 0 and myRoll < self.miss:
            return "Miss"
        elif myRoll >= self.miss and myRoll < self.dodge:
            return "Dodge"
        elif myRoll >= self.dodge and myRoll < self.parry:
            return "Parry"
        elif myRoll >= self.parry and myRoll < self.block:
            return "Block"
        elif myRoll >= self.block and myRoll < self.hit:
            return "Hit"
Last edited by SplashyTanks on Tue Jul 14, 2009 10:47 pm, edited 1 time in total.
SplashyTanks
 
Posts: 8
Joined: Sat Aug 16, 2008 2:56 pm

Re: thecks matlab code, making it easier to setup

Postby theckhd » Tue Jul 14, 2009 5:33 pm

Just as a comment: I changed the way the "Extras" section works today, but since that's loaded with the default gear set, you can exclude that completely from your output if you like.

Also, with the changes coming in 3.2 I've axed the LoO_equipped variable, since it'll have 100% uptime and can just be modeled as a Libram with static block value. Whether this comes back to haunt me when I'm doing rotation simulations in the future is yet to be determined. :P

Nice job, by the way.
"Theck, Bringer of Numbers and Pounding Headaches," courtesy of Grehn|Skipjack.
MATLAB 5.x, Simcraft 6.x, Call to Arms 6.0, Talent Spec & Glyph Guide 5.x, Blog: Sacred Duty
User avatar
theckhd
Moderator
 
Posts: 7710
Joined: Thu Jul 31, 2008 3:06 pm
Location: Harrisburg, PA

Re: thecks matlab code, making it easier to setup

Postby SplashyTanks » Tue Jul 14, 2009 10:45 pm

Thanks for the updates theck. Let me know if anything else changes so I can keep up. I have never used matlab before so how does one use your code? I would like to write a matlab wrapper so the execution of all your code can be done from python. How would you start running your tps sim if you were using matlab? And are there any other custom files that need to be created besides the my_gear file?
SplashyTanks
 
Posts: 8
Joined: Sat Aug 16, 2008 2:56 pm

Re: thecks matlab code, making it easier to setup

Postby theckhd » Wed Jul 15, 2009 5:52 am

MATLAB is basically its own development environment. You type the code in an editor window and hit "run." I know it's possible to generate executable files from an m-file, but I've never messed around with it myself. The reason I stick with MATLAB is that it's
  • convenient, since I use it at work,
  • very good at handling calculations on large data arrays, and
  • good at producing pretty graphical representations of the data
A quick googling of "matlab python" turns up this link, which talks about an automatic matlab->python translator. That might be a good starting point.

There's no other custom files that would need to be changed for the simulations. If you can import gear, talent spec, and glyphs, the rest of the simulation is strictly deterministic.


As an aside: I've often thought it would be nice to convert the matlab code into a java applet that could import your armory data and calculate your TPS output, and then let you toggle some options (maybe gear, talents, whatever) to see how it changed. But I never really had time, and since I'm a physicist rather than a computer scientist or web designer, it would take a lot of time to get up to speed on how to design the web end of things.

As such, I decided just to focus on what I do well, which is the theorycrafting and analysis end of things. However, I'd be open to collaborating on a utility like the one I described, especially if someone else with a firmer grasp of how to do the web stuff was willing to do most of the integration work. I could translate the bulk of the MATLAB code into a simple script in another language fairly easily, I think.

If you're working on a python script that handles all of the armory interaction, that covers one of the areas that would be needed for the utility. If we could find someone to work on making a gui and linking the armory import with the simulation logic, I could see such a project getting off the ground.
"Theck, Bringer of Numbers and Pounding Headaches," courtesy of Grehn|Skipjack.
MATLAB 5.x, Simcraft 6.x, Call to Arms 6.0, Talent Spec & Glyph Guide 5.x, Blog: Sacred Duty
User avatar
theckhd
Moderator
 
Posts: 7710
Joined: Thu Jul 31, 2008 3:06 pm
Location: Harrisburg, PA

Re: thecks matlab code, making it easier to setup

Postby Jasari » Wed Jul 15, 2009 6:51 am

I was actually in the process of writing a web app that would pull your armory stats and give relative value of different talents, stats, etc. However, I wasn't able to find an easy way to pull block value from armory (it's not listed on your character sheet's xml file) and so I put it on hold for a couple days then went on vacation for two weeks. I wouldn't mind starting it up again, but would like some advice on the best way to pull BV.
User avatar
Jasari
 
Posts: 2195
Joined: Sun Apr 27, 2008 12:32 am
Location: Boston, MA

Re: thecks matlab code, making it easier to setup

Postby culhag » Wed Jul 15, 2009 8:24 am

Couldn't it all be integrated in a Rawr module ? That's basically what it's made for, calculating something based on your stats.
Actually I have no idea how the prot pally module is kept up-to-date.

Then again, I guess some people don't like having to download something if it can be done online.
User avatar
culhag
Maintankadonor
 
Posts: 1726
Joined: Wed Aug 06, 2008 7:50 am
Location: France

Re: thecks matlab code, making it easier to setup

Postby Nadir » Wed Jul 15, 2009 8:37 am

Jasari wrote:I was actually in the process of writing a web app that would pull your armory stats and give relative value of different talents, stats, etc. However, I wasn't able to find an easy way to pull block value from armory (it's not listed on your character sheet's xml file) and so I put it on hold for a couple days then went on vacation for two weeks. I wouldn't mind starting it up again, but would like some advice on the best way to pull BV.

Would it possible for you to tally the block value from equipped items? If so, the following formula would work:

Block Value = ([STR modifier*]*[White STR + STR from items]/2+[BV from items]-10)*[BV modifier*]

* 5/5 Divine Strength: 1.15
* 3/3 Redoubt: 1.3
Image
Nadir
 
Posts: 266
Joined: Mon May 04, 2009 8:37 am

Re: thecks matlab code, making it easier to setup

Postby Jasari » Wed Jul 15, 2009 9:33 am

Nadir wrote:
Jasari wrote:I was actually in the process of writing a web app that would pull your armory stats and give relative value of different talents, stats, etc. However, I wasn't able to find an easy way to pull block value from armory (it's not listed on your character sheet's xml file) and so I put it on hold for a couple days then went on vacation for two weeks. I wouldn't mind starting it up again, but would like some advice on the best way to pull BV.

Would it possible for you to tally the block value from equipped items? If so, the following formula would work:

Block Value = ([STR modifier*]*[White STR + STR from items]/2+[BV from items]-10)*[BV modifier*]

* 5/5 Divine Strength: 1.15
* 3/3 Redoubt: 1.3


The problem is finding the BV from equipped items. I know how total BV is calculated, but I don't know where BV from items, or even the BV of a particular item is listed in the armory.
User avatar
Jasari
 
Posts: 2195
Joined: Sun Apr 27, 2008 12:32 am
Location: Boston, MA

Re: thecks matlab code, making it easier to setup

Postby SplashyTanks » Wed Jul 15, 2009 11:14 am

Hi Jasari, the block value on the items will be on their own page.

http://www.wowarmory.com/item-tooltip.xml?i=45136

That url give you some xml to play with. Make sure you use item-tooltip.xml and not item-info.xml. Feel free to recycle my code. The next release will have total block value and will be much cleaner so to retrieve you just would need to use:
Code: Select all

import armory
import tankadin
import unique

newTankadin = armory.scrape("charactername","server name","location")

print newTankadin.BV



done :)
I'll put the new code out by the end of the day after im done debugging.



A web frontend would be great. Just need to find a server that has apache with mod_python installed.
SplashyTanks
 
Posts: 8
Joined: Sat Aug 16, 2008 2:56 pm

Re: thecks matlab code, making it easier to setup

Postby Jasari » Wed Jul 15, 2009 12:04 pm

Ah, the item-tooltip.xml is exactly what I was looking for, thanks!
User avatar
Jasari
 
Posts: 2195
Joined: Sun Apr 27, 2008 12:32 am
Location: Boston, MA


Return to Advanced Theorycraft and Calculations

Who is online

Users browsing this forum: No registered users and 1 guest


Remove Advertisements

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 380 on Tue Oct 14, 2008 6:28 pm

Users browsing this forum: No registered users and 1 guest