Hi all,
a few days ago I found the Weewar Battle Simulator: http://www-personal.umich.edu/~mwhorton/WWsim3.html
It's a really nice tool.
I thought about how to exactly calculate the probabilities for all possible battles' outcomes. And yes, I finally managed to write some python code, which does exactly calculate the battle result probabilities, without having to perform simulations. (Remember: I am not calculating the actual results of a battle (because of randomness), I am calculating the probabilities for all possible outcomes.)
Unfortunately, I do not have a root server or something I could run Django/Python at, to make use of this code. And I am not motivated enough to port it to dirty PHP or something like that.
Moreover I think that it's better, when everybody can see how to build such a calculator. For this reason I publish my code:
http://files.robertnitsch.de/wwbattlelib.zip
License: GPL v2
I hope some tools can profit from my work. ![]()
Regards, bmaker
Hi bmaker, would you mind if I ported it to Ruby?
No problem! Indeed, that would be even great.![]()
Considering there is some randomness in the way the actual weewar battles work, I don't know how you can exactly calculate results - the moment you introduce anything random, determinism is gone.
That said, Matt's might need a bit of tweaking to get more accuracy out of it, but until the weewar engine removes indeterminism from the battles, you can't get things "exactly" calculated.
Jason, read the code.
If you flip 4 coins and count the number of heads, that's similar to the process used in weewar battles. What does it mean to calculate results exactly? Simple - give the answer "0: 1/16, 1: 4/16, 2: 6/16, 3: 4/16, 4: 1/16". In other words, give the exact probabilities. The way the old simulator works is simulation - it tosses 4 coins a godawful number of times and tallies the results. bmaker is just saying he calculates the probabilities instead of guessing them from simulation.
GA is right. Calculating the exact results has been discussed before, but until now no one has had the will or know-how to do so... so I'm glad to see this and it is very cool!.
However, an elegant calculation will still yield the same result as a "godawful" simulation, a trivial task with modern computing.
Yeah, as per my usual MO, I didn't really read things well enough before spouting off.
Reading just takes so much time, time I could be spending with my kids!
GA is right. By the way I edited my post to explain what my code is actually intended to do...
There was a small mistake, making the calculator ignore the bonus value. I uploaded the new code (see first post for download link), so now the bonus should influence the probabilities as well.
I can serve this. I would rather serve Ruby code than Python code, though.
So, where is the latest source code, bmaker/mattgrande?
Sorry guys, I've been busy!
Sending ...