Coding, Terrain Advantage, Damage

Share and discuss strategies for playing the game, and get help and tips from other players.

Moderator: Forum Moderators

User avatar
Gyra_Solune
Posts: 263
Joined: July 29th, 2015, 5:23 am

Re: Coding, Terrain Advantage, Damage

Post by Gyra_Solune »

Personally I don't believe there is a such thing as luck whatsoever, and that every time probability is tested, it is pretty much independent of everything else. After all - technically speaking, testing two coin flips isn't an isolated system, because there have been coin flips before yours in the past. The idea that if you flip four coins and they all come up tails that the next one has a very high probability of coming up heads is based on the assumption that you're only starting from the first time you've flipped a coin and because it's a 50-50 chance, not coming up heads is an odd anomaly, but that's a rather arbitrary division line. Coins have been flipped billions if not trillions of times and in that sense they more or less even out to being evenly matched, so in the grand scheme of 'coins that have been flipped', your four in a row flips basically don't push the probability at all.

Or, to put it another way - let's say that a scenario in your calculator was going on. Perhaps a Thunderer since that's easy to calculate. It's against something with a 50% defense. So you attack once - it misses. Your calculator would say you actually have a 75% of hitting it the next time, and you attack the next round - but it misses again. The calculator would then say that the next turn, the Thunderer has an 88% of hitting its mark because it didn't make the previous 50% chances.

But what if you saved the current scenario, in that exact moment, and distributed it to 20 people so they could make that very attack with what your calculator is saying is an 88% chance for them. Would they hit this opponent 88% of the time because the previous two times the original Thunderer attacked, it missed, and therefore it has greater odds? No, it'd probably be about half and half whether they attack or not - because succeeding checks of probability don't actually take into calculation preceding ones. They are, for all intents and purposes, their own universes whenever they are calculated, and regression to mean only occurs when you draw lines between probability checks to analyze greater trends, they don't happen at each instance of a probability. A coin doesn't care how many times it's come up tails in the past, it's still going to land on any given side 50% of the time, because the seemingly unlikely event of a coin coming up tails 20 times in a row is actually common when coins are flipped trillions of times.
Tad_Carlucci
Inactive Developer
Posts: 503
Joined: April 24th, 2016, 4:18 pm

Re: Coding, Terrain Advantage, Damage

Post by Tad_Carlucci »

You need to learn to ask the correct question, and then you'll get the correct answer.

I've tossed 5 fair coins. All of them came up heads. So what are the odds the next coin will be heads? Exactly 50 percent.

I've tossed 5 fair coins. All of them came up heads. What are the odds of this occurring? Exactly 3.125 percent.

I've tossed 200 fair coins. What are the odds I can find a series of five heads in a row? About 96.6 percent.

It's this last one which really throws people.

ETA:
I'll add one of the initial tests for randomness: I've tossed 200 fair coins and did not find any series of 5 heads in a row. Is this random? Probably not.
It probably means someone saw the results, above, and "fixed" it because that run-of-five "should not happen so often!"
I forked real life and now I'm getting merge conflicts.
User avatar
Inky
Forum Moderator
Posts: 527
Joined: September 22nd, 2014, 1:02 am
Location: USA

Re: Coding, Terrain Advantage, Damage

Post by Inky »

Stating the obvious here... in the probability simulation posted earlier (with 7 rows and .5 probability to go left each time) there are more balls in the 2nd box than the 1st because there are multiple paths to get to the 2nd box whereas the first box can only be reached by going left 7 times. If you were able to see the path of each individual ball you would see that, of the balls which initially turned left 6 times, half will go left and half will go right.

Regression to the mean says the next value will likely be closer to the mean than the first extreme value, not that it will be on the other side of the mean to compensate.

In the boy/girl paradox the answer is 1/2 if you specify which child you are talking about, which is the case in the examples given here.

The martingale betting system only works with infinite money which most people don't have.
User avatar
taptap
Posts: 980
Joined: October 6th, 2011, 5:42 pm

Re: Coding, Terrain Advantage, Damage

Post by taptap »

How do we avoid that logic?
By reading and understanding what an independent event is before touching a computer / calculator. Where I live this is taught in 8th grade.

https://www.mathsisfun.com/data/probabi ... ndent.html
I am a Saurian Skirmisher: I'm a real pest, especially at night.
User avatar
Richter
Posts: 8
Joined: September 20th, 2016, 9:25 pm

Re: Coding, Terrain Advantage, Damage

Post by Richter »

Tad_Carlucci wrote:
ETA:
I'll add one of the initial tests for randomness: I've tossed 200 fair coins and did not find any series of 5 heads in a row. Is this random? Probably not.
It probably means someone saw the results, above, and "fixed" it because that run-of-five "should not happen so often!"
Then you flip 200 More, don't get them, you start to sweat at the prospect of placing no bets on that elusive 5 Heads.

Because it is supposed to happen, the same reasoning applies to games of chance anywhere. Each of your units has an initial pool of 'expected' results after long periods of time, if they don't get what was expected, people will first assume that something is going on, rather than exceptional luck being in play and another 1,000 Games being needed to find that average number.


As for Trillions of flips being needed, probably.

There is no such thing as an independent event, please contact quantum theorists if you discover it, they would like to be able to model our universe from outside of itself.

Image

Whenever the difference dropped below one hundred, as expected, there was a long run or several to compensate for it, which is as it should be. And if I keep going, I expect to see that over the course of time, if one side grows, due to this supposedly being a "fair" 50-50 coin, that the results must err within that range, with a tolerance.

Image

Now at ten thousand, we weren't betting we'd see a 7,500 - 2,500 Distribution. We don't get one. We don't think that 9,000 - 1,000 is likely, we assume it goes evenly down the middle. Because this is what it is supposed to do in the grand scheme of things. If we make people do 100 Of these exercises, perhaps we see one or two of these events, but the fact that they're even unlikely in the grand scheme of things is itself the issue.

Just as we tend to think that a 0.25 Event happening 0.50 of the time is odd, we'd tend to think it was odd if we did not get other events 'on time', at which point we're going into the less likely outcomes. Eventually someone goes into a match and is going to flip and get himself a 1 in 2000 Probability event, but he will almost always get that in 1 of 2000 games.

And in 1 of 2, 4, 8, etc, games, you can expect a certain thing to occur, or start to occur, and if it does not do so then you are currently looking at a problem.

It's easy to argue that a set of events can be seen as a single event, too. Sets are nice.

If you insist on bringing fundamental maths up, at least consider that even toddlers get this.

As for the probability of something going in one direction 0.25 Of the time? This is what will happen when you bet 50/50 on the second flip.

Image
Tad_Carlucci
Inactive Developer
Posts: 503
Joined: April 24th, 2016, 4:18 pm

Re: Coding, Terrain Advantage, Damage

Post by Tad_Carlucci »

What really saddens me is I know two things will come from this:

* someone will read the OP's misguided comments and believe them;

* and the OP will eventually complete his program and, not realizing how meaningless his work was, will return claiming it proves some error in the game.
I forked real life and now I'm getting merge conflicts.
User avatar
taptap
Posts: 980
Joined: October 6th, 2011, 5:42 pm

Re: Coding, Terrain Advantage, Damage

Post by taptap »

The dangers of self-education while disregarding the basics... or just anti-math trolling. I reported this thread, pointless as is.
I am a Saurian Skirmisher: I'm a real pest, especially at night.
User avatar
Richter
Posts: 8
Joined: September 20th, 2016, 9:25 pm

Re: Coding, Terrain Advantage, Damage

Post by Richter »

You're probably under the assumption I'm including the long-term chances to hit, not really.

The average damage calculations are tried and true in every game that has ever used dice, per turn, the average expected damage of a unit is what you use to get the best idea of what you're buying. It's not perfect in Wesnoth's case, because Wesnoth doesn't use for example, 2d7, it's just, you either hit or you don't. Average damage isn't as accurate for calculating it.

So my probability has to be slightly adjusted for it, if you were only 49% likely to land 2 hits, your average damage plummets, if you were 51%, that's an immediate boost.

As for completing something, I suppose doing something is better than doing nothing.
Tad_Carlucci
Inactive Developer
Posts: 503
Joined: April 24th, 2016, 4:18 pm

Re: Coding, Terrain Advantage, Damage

Post by Tad_Carlucci »

By that logic, when I was living in the Mid-west, for one of my contracts in California, I should have flown to London and, when the client asked where I was I could say "Well, at least I went somewhere! That's better than staying at home. On, and here's my bill for the travel expenses." But, ya'know what? I did sorta like actually getting paid. So, no, I solved the correct problem and booked my flights to SFO. But, if your client in San Francisco has no problem with you billing them for your vacation, have fun. Just don't try to convince us you saw the Golden Gate Bridge while you were there.
I forked real life and now I'm getting merge conflicts.
User avatar
Gyra_Solune
Posts: 263
Joined: July 29th, 2015, 5:23 am

Re: Coding, Terrain Advantage, Damage

Post by Gyra_Solune »

taptap wrote:The dangers of self-education while disregarding the basics... or just anti-math trolling. I reported this thread, pointless as is.
It's rather un-necessary to report this thread. That is for cases of active malicious breaking of forum rules - this is just a debate on how probability works.

In any event - the calculator thing you are positing is not likely to be included into the game regardless, mostly because I don't believe the game stores information on what previous attacks were anywhere outside the replay. IIRC at any given point you're looking at the game, all it actually has loaded is the current state of the battlefield - i.e. the positions of units and their current HP, and not what occurred to get there. So unless you ask the live state of the game to interface with the replay more actively and complicatedly, it's not actually going to be able to calculate any probability trends and the extent of its capabilities are already present in the existing current-attack probability calculator.
User avatar
skeptical_troll
Posts: 498
Joined: August 31st, 2015, 11:06 pm

Re: Coding, Terrain Advantage, Damage

Post by skeptical_troll »

I'll just try to stress a single thing here: you interpret the law of large numbers as magical compensations that give you the expected mean after some time. It's not, of course. A better word than 'compensate' is 'dilute'. Exceptional deviations from the average are not 'actively' compensated by a change in probabilities as you seem to suggest, they simply become insignificant once a big-enough sample is drawn, but in a relative, not absolute sense.

In the case of the coin tossing, the central limit theorem tells you that the probability distribution of the number of heads after N flips tends to a Gaussian centered in N/2 and with standard deviation proportional to sqrt(N), i.e. increasing with N. This means that you get closer precision to the mean only in a relative sense ~sqrt(N)/(N/2), but worse precision in an absolute sense. The example you posted above, where you have a smaller arithmetic difference after 10000 flips than after 3000 flips, is just a single case with no statistical significance. Repeat that 100 times and you'll get a better feeling of what's going on, or even better look at what Brownian motions are. If what you say was true, a drop of wine in a glass of water should, in the long run, stay at its starting position and never spread out, cause the motion of each wine particle, on average, is zero.
User avatar
Inky
Forum Moderator
Posts: 527
Joined: September 22nd, 2014, 1:02 am
Location: USA

Re: Coding, Terrain Advantage, Damage

Post by Inky »

It's pointless to use logic, OP clearly just wants to argue for the sake of it, and it just happens that basic math was the victim this time.

Actually the real victims here are OP's poor, innocent Wesnoth units. They never even stood a chance. :cry: Take a statistics class today, it saves units' lives!
Post Reply