<< Back to Warzone Classic Forum   Search

Posts 21 - 25 of 25   <<Prev   1  2  
This is a bit ...: 9/13/2012 03:28:23

RvW 
Level 54
Report
So know i'm curious if anyone know(fizzer for sure:P) and would share this knowledge, how to calculate excat probabilty value for killing (at least) N armies when attacking X unit with army of Y. Assume that luck modifier is A and offense kill ratio is B. Looks like nice math task :D

I once tried that, got pretty far too..., but didn't succeed in figuring out the last few details. The calculation is rather complex and extremely ugly. One of these days (I've been saying that for half a year now though, so don't hold your breath :s ) I'll finish it completely.
And no, Fizzer (who, when I was almost done, invented a second rounding mode, which gave me even more stuff to figure out ;) ) doesn't have that formula himself either. The best he can do for you (and has done, in the "Analyse" window) is simply trying a hundred times, counting how many of those tries succeed and use that as an approximation.

ps. What Richard says is correct... but he "hides" one important detail: how to calculate the binomial itself. Doing that for small numbers is easy enough and with a computer you can do it for any number you're likely to find in a small or medium WL game, but in big games you will encounter numbers of armies for which it is not so easy any more.
Also, what I've been really breaking my head over is "If my opponent has X armies, the (offence) kill rate is Y and I want to be at least Z% sure the attack will succeed, with how many armies should I attack?". If you can find that formula, please share it with everyone!

you must attack with 14 to mathematically ensure victory.

Please note that when Richard says "mathematically ensure", he really means it. Especially on high luck settings, if you can live with a one-in-a-million chance of your attack failing, a far lower number of attackers will suffice. (In the extreme case of 100% luck, no amount of attackers will guarantee a victory; even a thousand attackers are not guaranteed to defeat even a single defender.)
This is a bit ...: 9/13/2012 04:52:15


Mythonian 
Level 55
Report
I'm seeing a big misconception in this thread (unless the wiki is severely out of date).

From the Wiki:

When an attack happens, WarLight calculates the "expected" number of armies that should get killed, assuming an average roll. The attack is also randomed as normal and these two numbers are interpolated based on the luck percentage.

...

If a player attacks with 100 armies, it is expected that it will kill 60 of the defending armies, but let's assume the random number generator determined that only 54 would get killed.

In a game with a luck percentage of 100%, WarLight will simply use the 54. However, in a game where the luck percentage had been reduced to 50%, WarLight would take the average of these numbers and would use 57 instead. If the luck percentage were 0%, WarLight would simply ignore the random and use the 60 every single time.


That means that even in 100% luck, getting wide variance like killing 0 is not simply the standard bell curve, but also you must take into account the random number which would need to be interpolated together with it.

This means that for 99% of the time, it's totally impossible to get a result of 0 kills with 10 attacking, at any luck values. It doesn't simply have a low percentage based purely on the luck, but also you need to account the possibility of where the random number would be at, and then compare that with the expected outcome and the luck modifier value.

What this ends up causing is the bell curves becomes significantly steeper, with anything after the first standard deviation becoming effectively negligible. (i.e., the true likelihoods of widely varying results are notably lower than would be expected based only on the luck value).
This is a bit ...: 9/13/2012 12:11:30


Krzysztof 
Level 67
Report

ps. What Richard says is correct... but he "hides" one important detail: how to calculate the binomial itself. Doing that for small numbers is easy enough and with a computer you can do it for any number you're likely to find in a small or medium WL game, but in big games you will encounter numbers of armies for which it is not so easy any more.
Also, what I've been really breaking my head over is "If my opponent has X armies, the (offence) kill rate is Y and I want to be at least Z% sure the attack will succeed, with how many armies should I attack?". If you can find that formula, please share it with everyone!


Could you precise how big those 'big numbers' are? I've written program to calculate
chance for killing (at least) X armies with given number of armies, luck and killRatio(your problem looks far more complicated at this moment). And it looks like it's working with as much as about 1500 armies(with standard killRatio, higher killRatio means it will fail with lower number of armies). For me 1500 looks quite enough(and even as i'm not 100% for this, i think i can increase it)

Also i've run some simulations and noticed strange(at least for me) thing. Even with 99% luck there is 99% chance that 100 armies will kill between 37 and 63 armies. Is this correct or something is wrong with calculation?
I've used this http://upload.wikimedia.org/math/6/8/d/68d0ba6ef5dfb8c654702c3290128b10.png for calculating 'default' probability that n armies will kill k units with p killratio. (this parts looks ok).
Those values are then modified wtih luck as described by Richard.
Probability for killing at least X units is obtained by simply adding probabilites for higher numbers(here can be some error because of adding many very small floating-points numbers, but it should'nt be significant).
Any hints?:P
This is a bit ...: 9/16/2012 00:07:30

RvW 
Level 54
Report
@Mythonian:
The wiki should not use a bell curve, that's indeed misleading (or: implicitly assuming a (non-standard!) kill-rate of 50%).

That means that even in 100% luck, getting wide variance like killing 0 is not simply the standard bell curve, but also you must take into account the random number which would need to be interpolated together with it.

Example, we're doing an attack; "expected-value" says "kill 8" and (digitally) throwing a few dices gives (for this particular attack!) makes "luck" say "kill 0".

I haven't yet told you what luck modifier this game uses, but you already know this attack will kill somewhere between 0 (inclusive) and 8 (inclusive) armies. On standard 75% luck we'd get 75% * 0 + 25% * 8 = 2 kills. But in the extreme case of 100% luck, the interpolation is degenerated into simply taking the "luck" value. Of course, technically it's still an interpolation: 100% * 0 + 0% * 8 = 0 kills, but it might not "feel" like an interpolation. I think this is were your misunderstanding comes from.

In practice, for more-or-less large numbers, it practically never happens all the roles fails, so you're incredibly unlikely to ever see it happening, even if it theoretically could. For instance, a 100-vs-1 attack, with 50% kill rate and 100% luck fails with chance 1 / ( 1/2 ^ 100 ), quite literally a one-in-a-million chance (or "1 in 1048576" if you're feeling pedantic ;) ).
On the other hand, especially for small numbers, it's not necessary to kill 0.000 armies; anything strictly smaller than 1 has a chance of being rounded to 0 (on stochastic round) / anything strictly smaller than 0.5 will always be rounded to 0 (on straight round).



@kszyhoo:
If you write your own code (and can use something called "Extended precision floating point numbers", 16378 armies will work, 16379 armies will fail. The problem is not with the final result of the calculation, that's a (relatively) small number. The problem is halfway through the calculation, you have to work with insanely huge numbers, which simply get too big to handle (without special tricks).
If you cannot use extended precision (but are stuck with double precision) you top out much sooner, but I don't have the exact number readily available.

Regarding your other question:
That looks symmetric around n = 50, did you use a kill rate of 50%? If so, yes, that's to be expected! You see, there's not that much of a difference between 99% luck and 100% luck. And 100% luck and a kill rate of 50% means you get a "Normal distribution" (also know as the "(Gaussian) bell curve"). Sure, in theory it's probability of any particular result never reaches zero, but more than two or three standard deviations from the middle, those chances get incredibly small.
This is a bit ...: 9/17/2012 00:34:24

General Arun {Warlighter}
Level 2
Report
n00b!
Posts 21 - 25 of 25   <<Prev   1  2