Mathhammer & Stathammer tool

Discuss tactical and strategic development for 40K/Tau.
User avatar
Kael'yn
Fio'Ui
Fio'Ui
Posts: 1092

Mathhammer & Stathammer tool

Post#1 » Apr 21 2013 04:37

Since I've seen that mathhammer is useful in these days of new shining gifts (or nerfed ones) for our codex, I decided to share my own tool.

It's mostly a long-tested by myself beta-version. And I need stranger eyes on it to improve and correct mistakes.
It started with a simple spreadsheet to speed up comparating units stats from http://www.heresy-online.net/combatcalculator/shooting.php.
Now it's a full grown-up collection of interactive spreadsheets.
It contains interactive tables of all stats involved in the amount of wounds and their distribution in the shooting phase.

User guide
How this tool could help me ?

Need to get the amount of wounds an unit does on another (even if it's vehicle) ? And what will be the retaliation ?
Use the "Shooting Range" sheet
Preview

Need to compare efficiency of two units versus the same target ?
Use the "Shooting Challenge" sheet
Preview

Need to see the total effects of up to 4 different shootings on a target ?
Use the "Cumulative Shooting" sheet
Preview

Need some miscellaneous statistics ?
Check if they are on the "Special" sheet. If they were not, ask for them by PM or in a reply.
Tables available for now:
- Markerlight Hits, statistics up to 10 hits
Preview
- Jokaero Upgrades Chances per Joakero count.
Preview

Need to get all the pure statistics of an unit against anything ?
Use the "Shooting Performance" sheet
Preview


Can I add new units ?
Add your own unit in the "Units" sheet
See the ReadMe sheet to have more hints about the values to be put in the cells.

Quick usage guide
1/ Choose the sheet you want to use.
2/ Choose units in the blue cells
3/ Facultative: Enter overriding values in the black cells below the value to change.
4/ Check Average Mathhammer results (in Gold background cells) or Stathammer data (white background cells) and curves

The Tool
Download :
version 11 (2013-06-11)
Zip file : Contains original ODS and XLSX & XLS conversions

File format provided
ODS spreadsheet : LibreOffice file (original version), compatible with OpenOffice
XLSX spreadsheet : Excel file (converted, Excel 2007 or more needed)
XLS spreadsheet : Excel file (converted, legacy Excel 97 version)
(I don't have Excel on my computer so the conversions are not tested at this time)

Previous Version :
version 10 (2013-06-03)
Zip file : Contains original ODS and XLSX & XLS conversions
Warning
v10 is designed to be OpenOffice compatible (after v8 and v9 problems).
If you had problems with, either download for free LibreOffice or use v7. Also please help by posting your trouble here or by PM.

version 7 (2013-04-29) LAST KNOWN OPENOFFICE COMPATIBLE VERSION
Zip file : Contains original ODS and XLSX & XLS conversions

Changelog :
version 11 (2013-06-11)
New Features:
- New Sheet : Cumulative Shooting
- New Sheet : Special tables

version 10 (2013-06-03)
Error corrections:
- Misplaced reference in some sheets.
- Rending now takes correctly into account invulnerable save (Now, Sniper Kroots and FW have really the same % to kill TEQ).
- Some unit profiles.
Changes:
- Style framework (for better OpenOffice/older Excel compatibility)
New Features:
- Shooting Performance with autosized graphic data and mini calculator
- Separated Cover Save from Invulnerable. FT weapon remove it.
- Feel No Pain Save
- Instant Death used for moral thresholds
Experimental:
- Special Shots : FT / SB / BB (templates: Flamethrower/SmallBlast/BigBlast). FT autohit regardless of BS. SB/BB is submitted to BS chance (working on a system to evaluate efficiency based on BS)

version 9 (2013-05-30)
Error corrections :
- Some units profiles (Riptide, Crysis with TL-Flamer)
- Some overriding values weren't matching : fixed
- Errors in average explosions chance and vehicle saves
Upgrades :
- Better morale checks detection on multi-wounds units
New Features :
- Rending may now works with 1/6 AP=2, this leads to reworking on save and AP : use « - » (dash) to set No AP or No Save
- Saves are now restricted to those values on Shooting Range and Shooting Challenge : -/6/5/4/3/2

version 8 (2013-05-15)
Error corrections:
- Vehicle tables (armor penetration rolls)
New Features :
- Points / wounds,HP,damages,explosions. Points are user input. They will not be added in the table to avoid troubles with giving unit with point costs.
- Highlighted the simple mathammer values in the sheets (gold background)

version 7 (2013-04-29)
Error corrections:
- Colors
- Explosions chance in Shooting Challenge
New Features:
- Ordnance weapon modifier added to the table ("O" flag)

version 6 (2013-04-24)
Error corrections:
HP removing in Shooting Challenge

Additionnal informations
Reminder:
It need some testing to be 100% accurate (copy-paste of formulas can be messy sometimes and some exotic value used can mess the tool)
So keep in mind that the stats given may be (hopefully not in most case) false.
And don't forget that a sucessful Shas'O doesn't win on equations, but on a sharp strategic ability (if the Dice God doesn't curse him...)

Share here or by PM me the comments, errors, ideas to improve.
Hope it will help those wanting a more in-deep statistics of our armies.

Hidden data
The tool includes also hidden data, mostly test fields. You can check them if you want (unhide them by right-clicking on the sheets tabs)
"Tables" sheet is the key of most all the comparing (BS to hit, S to wound / to glance / to penetrate, ... ).
It have also a very basic Melee Arena (with Melee units).
And some results I've obtained in testings (template hits based on BS, target spread, ...)

Last word :
Why the sheets have luck modifiers ?
Because I have seen that my own performances are better computed with a luck for me @ 80% :::( and not 100% like my brother have (Ok, for one of them his luck factor is more 120% :-( ).

Copyright and Legal Informations
Sources
Use partial data, ruleset and names from Games Workshop's "Warhammer 40.000" game system and members of Advanced Tau Tactica board.
All copyrighted items and/or names belong to their respective authors. No challenge intended.

License :
Creative-Commons 3.0 NC-By
This tool is for educational/non commercial use only.
You can modify and repost the file without permission for non-commercial use, but you will need to give a link to the original file and the author's name.

Author :
Claude LANAUD (aka Kael'yn on this board)


EDIT: Most edits of this post are updates / spellchecking. Others will be detailed here:
2013-06-11 : Adding some styles for enhance the OP clarity. Added minor infos on use, legal, ... Added some example images.
Last edited by Kael'yn on Jun 11 2013 10:40, edited 15 times in total.

User avatar
Iceplague
Shas
Posts: 69

Re: Mathhammer & Stathammer tool

Post#2 » Apr 21 2013 07:42

thanks! Been looking for this and thought it'd take a month or two until someone made one available for the masses. :)

User avatar
Agentarrow
Fio'Vre
Fio'Vre
Posts: 1618

Re: Mathhammer & Stathammer tool

Post#3 » Apr 21 2013 11:20

This is more of a tactics tool than a hobby tool. Gonna move it up to the Upper Concourse. Neat resource though.

User avatar
Kael'yn
Fio'Ui
Fio'Ui
Posts: 1092

Re: Mathhammer & Stathammer tool

Post#4 » Apr 22 2013 06:11

Thanks !

@Iceplague :
Creating it take some hours in this format when you know the good formulas (and some probability tricks).
In fact this is a rewriting (and cleaned version) of my huge original stathammer suite which was developed in two one year of loose work.
It started from an all-equation from user input stats (and too many conditionnals tests) to a table-lookup autofilled tool.

@Agentarrow :
I posted it in the lower concourse since it lacks testing and I didn't wanted to post in upper concourse a beta-version tool.
But if you feel it's Ok, so thanks.

User avatar
Jochmann
Shas'Ui
Shas'Ui
Posts: 413
Contact:

Re: Mathhammer & Stathammer tool

Post#5 » Apr 23 2013 05:19

I got some problem with mathammer, concerning vehicles:
I am at the moment working out, how many HP a AV10 vehicle averagely loses when shot by a Burst cannon, BS3:
Math, as I intend it to use, is as follows:

(1/2x1/3)exponent4 x 4hits +
(5/1296) x 4 x 3hits +
(25/1296) x 6 x 2hits +
(125/1296) x 4 x 1hit = 0.666hits

The problem occurs with the twin-linking:
Since the twin-linking reduces the divider (which is exponent4), it greatly increases the chances to hit; to an amount, which I disbelieve, but I can't find the flaw in my math:

(3/4x1/3)exponent4 x 4hits+
(5/256) x 4 x 3hits +
(25/256) x 6 x 2hits +
(125/256) x 4 x 1hit = 3.382hits

This seems in comparison way too much. Can anybody help me with that?

User avatar
Kael'yn
Fio'Ui
Fio'Ui
Posts: 1092

Re: Mathhammer & Stathammer tool

Post#6 » Apr 23 2013 06:37

Jochmann wrote:I got some problem with mathammer, concerning vehicles:
I am at the moment working out, how many HP a AV10 vehicle averagely loses when shot by a Burst cannon, BS3:
Math, as I intend it to use, is as follows:

(1/2x1/3)exponent4 x 4hits +
(5/1296) x 4 x 3hits +
(25/1296) x 6 x 2hits +
(125/1296) x 4 x 1hit = 0.666hits

The problem occurs with the twin-linking:
Since the twin-linking reduces the divider (which is exponent4), it greatly increases the chances to hit; to an amount, which I disbelieve, but I can't find the flaw in my math:

(3/4x1/3)exponent4 x 4hits+
(5/256) x 4 x 3hits +
(25/256) x 6 x 2hits +
(125/256) x 4 x 1hit = 3.382hits

This seems in comparison way too much. Can anybody help me with that?


Mathhammer can be simple or very complex, but the first thing in all the case is to calculate the p=% of wound/HP/damage you deal with ONE shot first.

Basic Mathhammer, if you want average (not accurate) amount of wound dealt by a n=number of shots, you just multiply the two numbers: Average=n x p .
In this case, you consider that having 25% to removing 1 wound is equal of removing 0.25 wound. Not exact, propability wise, for more than one shot.

Accurate Mathhammer (I called is Stathammer) is the % of probability to have k exact success (1,2,3,...) or k minimum success (1+,2+,3+,...) on a total of n shots, each shot is at p probability. This is called the repartition function.
This can tell you "I can remove 2 HP with 95% chance, 4 HP with 50% chance, ...",
The Basic Mathhammer n x p average amount is roughly equal (but not all the time, see below) to the 50% chance.

In your example:
S5 vs AV10 @ BS3
To hit:
BS3
= 3/6
= 1/2
= 50% to hit

BS3-TL (twin linked)
= 3/6 + (100% - 3/6) x 3/6
= 50% + 50% x 50%
= 50% + 25%
= 75%
(or 3/6+(3/6)x3/6
= 18/36+9/36
= 27/36
= 3/4)
(the probability to hit at first + the probability to fail x the probability to succeed on the second attempt)

To remove HP
S5+1D6 >= AV10 only if D6=5 or 6
So we have a 2/6 = 1/3 = 33% to remove HP (glance or penetrate)
(to penetrate, it's only 1/6)

Without save (Each save/Deny the witch/Feel no Pain/... add another multiplier to the stack), we can then multiply the two probabilities to have the chance for ONE shot to remove ONE HP :
BS3 : 1/2 x 1/3 = 1/6 = 17%
BS3-TL : 3/4 x 1/3 = 4 / 12 = 1/4 = 25%

Average Mathhammer (4 shots):
Now when you have this base chance you can use the basic helper
4x17% = 0.66 HP @ BS3
4x25% = 1 HP @ BS3-TL

Stathammer (4 shots too):
Math reminder
[spoiler=Math for the Math God !]P(X=k) = ( n! / (k! x (n-k)!) ) p^k x (1-p)^(n-k)
P(X=k) is the % of having k success on n occurrences, each success happens at p probability, and a! = 1x2x3x...xa

In a LibreOffice spreadsheet formula this pure math formula for P(X=k) is given by =BINOMDIST(k;n;p;0) (0 is the cumulative flag: 0 means exact k success, 1 means at most k success)[/spoiler]
(note: BS3 -/- BS3TL)
P(0 HP) = 48% -/- 32%
P(1 HP) = 39% -/- 42%
P(2 HP) = 12% -/- 21%
P(3 HP) = 2% -/- 5%
P(4 HP) = 0% -/- 0%

To have the minimum HP lost, you add each chance of loosing equal or more :
Adding % is valid here because all % are the same experiment outcomes and their total is 100%
Adding (or multiply by the number of occurences) results from different experiments as in Average method isn't valid since their sum isn't 100%

Example @ BS3: P(1 HP min) = 39+12+2+0
So:
P(1 HP min)= 52% -/- 68% (yes it's also 100%-P(0 HP))
P(2 HP min)= 14% -/- 26%
P(3 HP min)= 2% -/- 5%

So what do we have instead of Mathhammer standard:
We have at BS3 1/2 chance to remove at least 1HP, more useful to say than "remove 0.66 HP"
We have at BS3-TL 2/3 to remove at least 1HP, and here we don't have the false idea that we can remove 1HP per shot (an average is untrustfull for human mind).

Note if we add the base% x number of wounds as in the average method we get the previous average:
(I used exact values, not rounded): 0.39+0.12*2+0.02*3 = 0.66 HP and 0.42+0.21*2+0.05*3 + 0.00*4 = 1.00

I found the Stathammer way to think more in line with the game mechanics, which is all about risks and chances when deciding rather than having an hope to remove an average number of wounds/HP.
In this case : One BC is not very effective against AV10, because even twin-linked you cannot remove surely on HP. Having two not twin linked BC at BS3 grow the % to remove at least one HP at 77%
To remove surely 1HP (i take for that the 95% line) you need 4 BC (16 shots). And you cannot be 100% sure, even if you take 10+ BC (even if the miss is a very sign of bad luck, because with 10BC you are at 97% to remove 3HP or more, but you have 1/1000 chance to fail all rolls)

Hope you understood better.
I had not understood why you use exponents.
Could you share a brief explanation of your method ?


Note:
My Shooting Challenge has a wrong reference for the second unit, using the % to hit from the first for some stats.
I will upload this correction soon, when I will have a second look onto other cells maybe messed with multiple copy-paste.
You don't pointed it specifically, but I see it in my checking. Thanks.

EDIT: Corrected a mess about average vs additions of ponderated ratios. They are the same, just forget about some % to include.
Last edited by Kael'yn on Apr 23 2013 08:02, edited 2 times in total.

User avatar
Jochmann
Shas'Ui
Shas'Ui
Posts: 413
Contact:

Re: Mathhammer & Stathammer tool

Post#7 » Apr 23 2013 06:50

Great! Thank you. My "calculus of probabilities class" (? German: Wahrscheinlichkeitsrechnung) is 10 years back, I seem to have forgotten a little bit ;)

User avatar
Kael'yn
Fio'Ui
Fio'Ui
Posts: 1092

Re: Mathhammer & Stathammer tool

Post#8 » Apr 23 2013 08:15

Me too, my math is old, but since I do some evening lessons of maths and science for young adults, I was forced to an huge work to update my knowledge.

User avatar
Kael'yn
Fio'Ui
Fio'Ui
Posts: 1092

Re: Mathhammer & Stathammer tool

Post#9 » May 15 2013 06:48

New Version : v8 (2013-05-15)
Error corrections in vehicle tables
Added points / wounds,HP,damages,explosions. Points are user input. They will not be added in the table to avoid troubles with giving unit with point costs.
Highlighted simple mathammer values in the sheets (gold background)


As usual, comments are welcome.

User avatar
Onerios
Shas
Posts: 90

Re: Mathhammer & Stathammer tool

Post#10 » May 18 2013 02:53

Spotted an error on the unit profile for the HBC Riptide, it should be 8 shots, not 6. Going to do a blitz through now to see if there are any other things like that.

EDIT: Ok, can't see any other glaring mistakes in the unit profiles (I lied, nova HBC should have rending against tanks, and on that topic, rending does not seem to be working full stop, its not factored into the infantry results and it throws up errors on tanks), second pair of eyes would be nice. Could you put a checksum for the archive, as that seems to be a fairly major error, want to be sure that its not a problem with the file being downloaded. As a possible addition in later versions, separate out innate cover saves and invun saves, and add a modifier tag to ignore cover. This lets you simulate things like noise marines and the effect of markerlights with less modification by the final user.

moebius
Shas
Posts: 34

Re: Mathhammer & Stathammer tool

Post#11 » May 19 2013 04:26

It won't work on my libreoffice :( Many cells are ### in shooting performance and shooting range..
Which version of LO do you use? Do i need to install some additional package?

User avatar
Kael'yn
Fio'Ui
Fio'Ui
Posts: 1092

Re: Mathhammer & Stathammer tool

Post#12 » May 19 2013 07:00

@Onerios:
Thanks for checking.
- HBC modified in my version (Units sheet is already modifiable by user, and the Riptide profile was added on my mother file when rumors chimes, then copy-pasted). I don't check the table as often as the calc sheets.
- Checked rending. Riptide HBC only missed "R" in the APM column of Units Sheets.
yes it only work on vehicles damage and on wounding infantry for now (since it just use tables, it is more easy to include than modifying cells values).
(You can check the damages/wounds tables used by right clicking on the sheets tab>Show>"Tables">OK)

I am working on a better framework for saves to include armor/inv/cover saves and their modifiers. At this time I already have an AP-ignorable (armor) and an always-given ones (inv or cover). I am thinking about how apply the 1/6 AP2 on infantry (sniper, rending, ...).
So AP 1/2 & ignore cover weapons may be tricky, but if you let the Inv to 7 (no save), it will work (but not in shooting challenge if you want to compare ignore cover effects on one unit)

In zip files, if the file is corrupted by download, you cannot extract it (libreoffice and xlsx files are basically xml files in one zip file so it work the same)

@moebius
Theorically works on all versions (Open Document is a standard, so it may work also with OpenOffice 1.0)
I run a recent version of LibO (4.0.2.2)

Are the ### errors or correct values ? Expand some columns to see.
If it's errors, then don't forget that only one side of tables can display stats (unit or vehicles)

### indicates that the value of the cell cannot displayed.
I use Arial Narrow 10pts for font. If you don't have it on your computer, select all the cells and use a small-spaced font.
Arial Narrow was used because I wanted to have all the data before my eyes on a 1600x900 screen.

moebius
Shas
Posts: 34

Re: Mathhammer & Stathammer tool

Post#13 » May 19 2013 09:51

If i stretch the cells, in some it appear #NAME? (like C18-C42 or D18-D42 if shooting range), in others (like f18-f41) Err:502. In addition if I change unit type the graphs are not shown in the small boxes. I think that err:502 comes out because #NAME? in the other cells

User avatar
Kael'yn
Fio'Ui
Fio'Ui
Posts: 1092

Re: Mathhammer & Stathammer tool

Post#14 » May 19 2013 12:35

moebius wrote:If i stretch the cells, in some it appear #NAME? (like C18-C42 or D18-D42 if shooting range), in others (like f18-f41) Err:502. In addition if I change unit type the graphs are not shown in the small boxes. I think that err:502 comes out because #NAME? in the other cells


Latest versions "blanks" many error cells, included the ShRng C18:D42 and F18:E42.
Error don't be relevant to the #NoName thing, since these cells doesn't use the previous.
Have you the last release (v8) ?

In the v8, I don't see where is troubles ...
With what unit combinations and/or overriding values you have these problems ?

User avatar
Kael'yn
Fio'Ui
Fio'Ui
Posts: 1092

Re: Mathhammer & Stathammer tool

Post#15 » May 29 2013 04:43

New version : v9 (2013-05-30)
Error corrections :
some units profiles (Riptide, Crysis with TL-Flamer)
Some overriding values weren't matching : fixed
Errors in average explosions chance and vehicle saves
Upgrades :
Better morale checks detection on multi-wounds units
New Features :
Rending may now works with 1/6 AP=2, this leads to reworking on save and AP : use "-" (dash) to set No AP or No Save (like in any unit profiles)
(Thanks to Onerios to push me to full integration, now sniper Kroots are more trustful against TEQ in the stats)
Saves are now restricted to those values on Shooting Range and Shooting Challenge : -/6/5/4/3/2
(User units in the tables need to be checked to use this, even some backward compatibility exists with the "7" value)

Since the save system has been reworked, errors may occurs now with some situations, even if I checked most of the situations (this is a limitation of the table search system)

Comments are welcome as always !

User avatar
Straylight
Por
Posts: 162

Re: Mathhammer & Stathammer tool

Post#16 » Jun 01 2013 04:58

Kael'yn wrote:
moebius wrote:If i stretch the cells, in some it appear #NAME? (like C18-C42 or D18-D42 if shooting range), in others (like f18-f41) Err:502. In addition if I change unit type the graphs are not shown in the small boxes. I think that err:502 comes out because #NAME? in the other cells


Latest versions "blanks" many error cells, included the ShRng C18:D42 and F18:E42.
Error don't be relevant to the #NoName thing, since these cells doesn't use the previous.
Have you the last release (v8) ?

In the v8, I don't see where is troubles ...
With what unit combinations and/or overriding values you have these problems ?


I can confirm that the v8 and v9 sheets are broken in older versions of both OpenOffice and LibreOffice. In LibreOffice 4.0.3 (latest), however, they work correctly.

Likely this is due to some sort of syntax processing change between older versions and current releases, as the #NAME? error indicates that the program is failing to process an invalid field or class name.

User avatar
Kael'yn
Fio'Ui
Fio'Ui
Posts: 1092

Re: Mathhammer & Stathammer tool

Post#17 » Jun 01 2013 05:27

Straylight wrote:I can confirm that the v8 and v9 sheets are broken in older versions of both OpenOffice and LibreOffice. In LibreOffice 4.0.3 (latest), however, they work correctly.

Likely this is due to some sort of syntax processing change between older versions and current releases, as the #NAME? error indicates that the program is failing to process an invalid field or class name.


I got the analysis by PM.

Since v8, I use a formula to "blank" error cells (mainly those for units when vehicles are used and vice-versa).
OpenOffice has not this formula (IFERROR), so it brings errors all the way in cells when it need to be used.
It will work seamlessly in LibreOffice (the most supported little brother of OpenOffice) since I use it.
The other concern is Excel, since I don't know if the formula is correct in it, but since noone pointing me, maybe there is no problems.

I will try another way to blank the cells in the v10 soon, along with any error corrections provided by users.
In the meanwhile, i will include the v7 version links and warn about OOo compatibility

Thanks for testing.

User avatar
Kael'yn
Fio'Ui
Fio'Ui
Posts: 1092

Re: Mathhammer & Stathammer tool

Post#18 » Jun 03 2013 06:59

New version: v10 (2013-06-03)
Error corrections:
- Misplaced reference in some sheets.
- Rending now takes correctly into account invulnerable save (Now, Sniper Kroots and FW have really the same % to kill TEQ).
- Some units profiles
Changes:
- Style framework (for better OpenOffice/older Excel compatibility)
Upgrades:
- Shooting Performance with autosized graphic data and mini calculator
- Separated Cover Save from Invulnerable. FT weapon remove it.
- Feel No Pain Save
- Instant Death used for moral thresholds
Experimental:
- Special Shots : FT / SB / BB (templates: Flamethrower/SmallBlast/BigBlast). FT autohit. SB/BB is submitted to BS chance (working on a system to evaluate efficiency based on BS)

I removed the function that mess OpenOffice and maybe older Excel than 2007, relying only on test if unit is a vehicle to hide values.
Now it will work (hopefully).

I started to work on template deviation, but it's really a pain (for blast templates).
I used a Python script to roll 10 000 templates over units and started to see some things, but it's very difficult to put it into a generic frame.
Method : 3 styles of placement (Ranks&Files, Quincunx, Spiral (=Deep strike placement)) and put the template over the figure next to the center of the unit, then rolled deviation and count models under the template.
Counter-intuitively, it appears that a BS = 7 is the better BS to hit the max people (Not so surprising since it allow to mostly hit the target or next to it, covering more units than onto the target).

If you are interested to see the results, right click on the sheets tab and display the sheet "Template Deviation Testing"
If you want my Python script for using it yourself, PM me.

Return to “Tau Tactics”

Who is online

Users browsing this forum: Ifrit and 2 guests