Recommend
 
 Thumb up
 Hide
32 Posts
1 , 2  Next »   | 

War of the Ring (First Edition)» Forums » General

Subject: Battle simulator script rss

Your Tags: Add tags
Popular Tags: [View All]
Scott Shorter
United States
Rockville
Maryland
flag msg tools
http://wotr.nfshost.com/sim.php is a simulator I built to help be figure out the odds of different sorts of battles. As the tiny description on the page says:

Quote:
This page runs simulations of battles according to the rule of the brilliant boardgame the War of the Rings. I created it because it was easier than trying to figure out the mathematical probabilities of the various scenarios. To use it, set up the scenario that you want to test and click the submit button at the bottom of the form. The script will then run 500 battles and report simple statistics about their results.

There's no major AI involved - the simulator will fight to the death, instead of sensibly retreating, for example. The one AI choice I had to program in was how to take hits, and the algorithm is ludicrously simple: if an elite is available, reduce it to a regular, otherwise lose a regular - unless you are the attacker in a siege, in which case elites will be reduced only if no regulars are available.


Let me know by posting here or messaging me if you like the tool - if there's no interest, I may take the page down.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dick Jarvinen
United States
Corvallis
Oregon
flag msg tools
designer
Avatar
mbmbmbmbmb
Re:Battle simulator script
Randulf (#459474),

Oh, cool! Don't take it down!!!

But...

Ya kinda need another unit type to handle the Wargs.

(I wanted to run some tests when the Isengard units attack the poor Rohan weakies.)
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Scott Shorter
United States
Rockville
Maryland
flag msg tools
Re:Battle simulator script
djarv (#459483),

If you want to simulate Wargs (with Saruman in play) then just put in the appropriate number of leaders to match the number of elites.

Glad you like it.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dick Jarvinen
United States
Corvallis
Oregon
flag msg tools
designer
Avatar
mbmbmbmbmb
Re:Battle simulator script
Randulf (#459484),

Well... but that doesn't work quite right.

If I lose (or reduce a Warg), I also lose a leader, so that will have some effect on the battle.

Sorry, but these things always seem to have a glitch or two!
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dick Jarvinen
United States
Corvallis
Oregon
flag msg tools
designer
Avatar
mbmbmbmbmb
Re:Battle simulator script
djarv (#459493),

And really, it is great! I've been running some sieges, and the results in some cases are astounding!

No wonder I've been losing those damn battles. Not enough units!!!
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Scott Shorter
United States
Rockville
Maryland
flag msg tools
Re:Battle simulator script
djarv wrote:
Randulf (#459484),

Well... but that doesn't work quite right.

If I lose (or reduce a Warg), I also lose a leader, so that will have some effect on the battle.

Sorry, but these things always seem to have a glitch or two!


Yeah, that occurred to me after I replied to you. I'll ponder how to handle that - for now enjoy the tool as is.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Scott Shorter
United States
Rockville
Maryland
flag msg tools
Re:Battle simulator script
And really, it is great! I've been running some sieges, and the results in some cases are astounding!

No wonder I've been losing those damn battles. Not enough units!!!


Heh, enlightening, isn't it?

Let me know if anything too odd or unbelievable shows up - it might be real or it might be a bug in the script.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Yann M
France
Avon
Unspecified
flag msg tools
mbmbmbmbmb
Re:Battle simulator script
Randulf wrote:
http://wotr.nfshost.com/sim.php is a simulator I built to help be figure out the odds of different sorts of battles. As the tiny description on the page says:

Quote:
This page runs simulations of battles according to the rule of the brilliant boardgame the War of the Rings. I created it because it was easier than trying to figure out the mathematical probabilities of the various scenarios. To use it, set up the scenario that you want to test and click the submit button at the bottom of the form. The script will then run 500 battles and report simple statistics about their results.

There's no major AI involved - the simulator will fight to the death, instead of sensibly retreating, for example. The one AI choice I had to program in was how to take hits, and the algorithm is ludicrously simple: if an elite is available, reduce it to a regular, otherwise lose a regular - unless you are the attacker in a siege, in which case elites will be reduced only if no regulars are available.


Let me know by posting here or messaging me if you like the tool - if there's no interest, I may take the page down.


THANK YOU !!!!
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Rich Moore
United States
Oxford
Ohio
flag msg tools
badge
Gotcha!
Avatar
mbmbmbmbmb
Re:Battle simulator script
Randulf (#459474),
Don't get me wrong, this is a really cool tool...I even tried the non-computational approach of actually rolling dice (that lasted for all of 3 battles)to see what size armies are need by the SP to take a stronghold (I came out with approxiately 2X the units, although according to the simulator, this really doesn't cut it.)

BUT, what it cannot mimic is the play of combat cards, and this makes all the difference in the world. Indeed, I tried to simulate my ideal SP attack force of 3 elites, 7 regulars, and 5 leaders against the standard Minas Tirith defense unit of 3 regulars, 2 elites, and 1 leader, and my "ideal" force lost over 80% of the time. This is NOT what happens in a game. In the game I'm playing combat cards with each attack, getting bonuses added to my rolls, getting free hits, etc, etc. Then you have to take into account the possibility of the defenders cards...it boggles the mind how to simulate that!

Bottom line, you've created a very cool toolcool, but one that must be interpreted with care, as it isn't an accurate simulation of the seemingly limitless possibilities that can occur during actual game play.

Rich
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dick Jarvinen
United States
Corvallis
Oregon
flag msg tools
designer
Avatar
mbmbmbmbmb
Re:Battle simulator script
rcmoore4 (#459635),

I have to respectfully disagree. First, there are many occasions when I don't want to waste a combat card, or want to know what my odds are if I don't play a card.

A good example is an early attack against the Fords of Isen. Neither player will have many cards in his hand, and is unlikely to waste any on what is considered a 'minor' battle.

In the case of larger battles (against Minas Tirith, for example), it is very helpful to know what the odds are before playing any cards. If it turns out that the odds are very much against you, then that tells you that you should either very quickly find some good combat cards, or break off the attack. If the odds are definitely in your favor, then you may not play that valuable Event Card that could better be used against the Fellowship.

In almost any kind of analysis, one must start with the basics before you can move on to a deeper and more thorough review.

I believe that Randulf has created an exceptionally valuable tool, and I look forward to using it extensively in the future.

But then... remember, I am a 'math geek'.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dick Jarvinen
United States
Corvallis
Oregon
flag msg tools
designer
Avatar
mbmbmbmbmb
Re:Battle simulator script
Dang, I wish you could edit posts in this forum!

I made that stupid 'math geek' comment thinking I was just making fun of my own geekiness in liking math toys and number tricks and such; instead, it came out sounding pompous and like I was saying "Hey, I must be right, I know math!" which is absolutely not the case.

Ah crap, this post probably compounds the error. Sigh...
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Peter K. Hubig
Germany
bei Aschaffenburg
flag msg tools
badge
Avatar
mbmbmbmbmb
Re:Battle simulator script
Randulf (#459474),
, can you make it downloadable? That would be of invaluable help. Thanks for the good work!
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Rich Moore
United States
Oxford
Ohio
flag msg tools
badge
Gotcha!
Avatar
mbmbmbmbmb
Re:Battle simulator script
djarv (#459683),
Your point is well taken...I tend to be a bit overly cautious when it comes to playing combat cards. I pretty much assume ANY siege battle is not in my favor and try to play a card...even if the battle is winding down and there are only a few defenders left. Of course using the battle simulator is useful for determining under which situations you might want to use a combat card. As in the example I gave...my ideal sized army vs a moderately well-stacked Minas Tirith. Since unaided I would loos 80% of the time, I'll be sure to use some combat cards during that battle!

Rich
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Scott Shorter
United States
Rockville
Maryland
flag msg tools
Re:Battle simulator script
rcmoore4 wrote:
Randulf (#459474),

BUT, what it cannot mimic is the play of combat cards, and this makes all the difference in the world.


Nor does it claim to, nor do I feel like putting the effort in to make it handle that. The purpose is to test the effects of changes to force composition and types of battle all things being equal and of course combat cards will skew that heavily.

Bottom line, you've created a very cool toolcool, but one that must be interpreted with care, as it isn't an accurate simulation of the seemingly limitless possibilities that can occur during actual game play.

Glad you like it, and I agree about it's limitations.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Scott Shorter
United States
Rockville
Maryland
flag msg tools
Re:Battle simulator script
pkh1 wrote:
Randulf (#459474),
, can you make it downloadable? That would be of invaluable help. Thanks for the good work!


http://wotr.nfshost.com/sim.zip

It's atrociously documented, and includes parameters that are not yet supported. Caveat emptor.

If you make any great improvements to it, let me know and I'll see about integrating them into my version.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Michael Dworkin
United States
Montpelier
Vermont
flag msg tools
mbmbmbmbmb
Re:Battle simulator script
Randulf (#459823),

Congratulations on your modest,; but I have to say that your little program may seem simple to you, but it certainly does many things that I could not have done without it; and in doing them, it offers insights and enlightenment and just plain fun...plus a question that I outline below:

I was struck by the relatively high degree of variability when I set up several situations and then resolved each one multiple times. for example, for the same inputs/set-up the reported results could yield a 60% chance of a win the first time, a 63% chance a second time, and a 59% chance a third time, etc. etc.

This is usually unimportant in gaming terms. No one should rely on knowing the result of 500 run-throughs as a "guarantee" of what will hapen in an actual game attack. It is guidance, not a promise of future performance, and it doesn't tell one either the probability or the range of likely deviation form the reported result. In fact it still (thank heavens!) forces the player to make judgment-calls since few of the differences in reported results are far enough apart to alter an in-game decision (such as whether to attack or not, whether to spend a card, whether to have a back-up army nearby, etc.)

However, the observed variability in reported results does raises an interestng intellectual question (technically a question about standard deviation from the mean).

Since you used a number as high as 500 for each report of cumulative results, I would have expected a higher degree of convergence. (I.e., I would have expected multiple clicks on the resolve button to produce almost identical results). With, say, 50 run-throughs underlying each report, I would not have been surprised at the random variablity, but with numbers over 50 (particularly as high as 500) I am surprised.

Were YOU surprised by the variability in reported results?
Did you ever try setting it for 1,000 play-throughs per report and seeing whether the convergence is tighter?

I hope its clear this is NOT a criticism...its more an enjoyable bit of pondering, raised by your fascinating small program.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Scott Shorter
United States
Rockville
Maryland
flag msg tools
Re:Battle simulator script
I chose 500 because that produces results in as little as a second, and gives a general sense of the odds. The variability actually comes down painfully slowly - related to the inverse of the square root of the number of runs if I recall my statistics class correctly.

Experimenting briefly shows that with 10000 runs you still can get +/- 1% in the results, but of course it takes 20 times as long to achieve it.

MHDworkin wrote:

I was struck by the relatively high degree of variability when I set up several situations and then resolved each one multiple times. for example, for the same inputs/set-up the reported results could yield a 60% chance of a win the first time, a 63% chance a second time, and a 59% chance a third time, etc. etc.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Scott Shorter
United States
Rockville
Maryland
flag msg tools
Re:Battle simulator script
Lol. Considering that most of the readers are probably also self-identified geeks of one type or another, they probably just read it the way I did - you told us you were a math geek in order to differentiate what type of geek you are.


djarv wrote:
Dang, I wish you could edit posts in this forum!

I made that stupid 'math geek' comment thinking I was just making fun of my own geekiness in liking math toys and number tricks and such; instead, it came out sounding pompous and like I was saying "Hey, I must be right, I know math!" which is absolutely not the case.

Ah crap, this post probably compounds the error. Sigh...
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Michael Dworkin
United States
Montpelier
Vermont
flag msg tools
mbmbmbmbmb
Re:Battle simulator script
Randulf (#459874),

Your trade-off at 500 makes sense.... speed of response has high value here.

One old rule of thumb that I remember from statistics experts I've heard testify was that deviations from teh mean (or 'scatter") drop fast through increases sample size of up towards 50 examples...then slowly after that..and, to use your words, 'painfully slowly' after a few hundred. Given that, your cut off is probably in about the right place (not to mention being easy to remember as a kind of 'round number'.
Again, thanks for the nice toy.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dave J McWeasely
United States
Louisville
Kentucky
flag msg tools
designer
Avatar
mbmbmb
Re:Battle simulator script
I think the proper casualty removal algorithm, at least for the FP, is to usually get down to 5 guys asap, so that you can fit inside a stronghold. But once there, you want to maintain 5 guys as long as possible (by reducing elites).

I can think of exceptions, but they're rare: 4 regulars, 1 elite, and 5 leaders beseiging a lone regular,when resolving a single hit, would want to lose a regualar, saving the elite to continue the combat and probably win the next round. Or also some "sacrifice X units to get a 50/50 chance of killing X units" cards don't care what flavor units you have. But enough with the exceptions, here's the pseudocode:

Given R regulars, E elites, and H hits on them:

while H > 1
{
if R+E>5 && R>0
then R--, H--
else E--, H--
if R<1 && E<1
then exit( RAN_OUT_OF_ARMIES );
}
return R, E
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dave J McWeasely
United States
Louisville
Kentucky
flag msg tools
designer
Avatar
mbmbmb
Re:Battle simulator script

while H > 1
{
if R+E>5 && R>0
then R--, H--
else E--, H--, R++
if R<1 && E<1
then exit( RAN_OUT_OF_ARMIES );
}
return R, E
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Scott Shorter
United States
Rockville
Maryland
flag msg tools
Re:Battle simulator script
One enhancement I plan is to allow the user to select among different unit elimination strategies - this will be the "get me to 5 so I can run into the stronghold" strategy.

Quote:
MrWeasely wrote:

while H > 1
{
if R+E>5 && R>0
then R--, H--
else E--, H--, R++
if R<1 && E<1
then exit( RAN_OUT_OF_ARMIES );
}
return R, E
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Sean McCarthy
United States
Seattle
Washington
flag msg tools
designer
badge
Avatar
mbmbmbmbmb
Re:Battle simulator script
Randulf (#460574),

I don't think it's very useful to count a siege stall as a defender win. Most sieges require multiple attacks to complete; it would be ludicrous to assume that elites are necessary.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Dave J McWeasely
United States
Louisville
Kentucky
flag msg tools
designer
Avatar
mbmbmb
Re:Battle simulator script
SevenSpirits (#461107),
You're obviously playing some other game than me. What's your typical attacking & defending force? In our games its something like:

Minas Tirith: 3 regular, 2 elite, 1 leader for Gondor versus 9 regular, 1 elite, 3 Nazgul, 1 Witch King. The SP leadership advantage almost cancels out the stronghold bonus, and 11 hit points typically stomps the FP's 7. Once the FP takes 3 hits they stop rolling 5 dice, and they really go downhill fast from there.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Scott Shorter
United States
Rockville
Maryland
flag msg tools
Re:Battle simulator script
SevenSpirits (#461107),

Good point - I will consider adding siege stalls as an additional outcome to be tracked.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
1 , 2  Next »   | 
Front Page | Welcome | Contact | Privacy Policy | Terms of Service | Advertise | Support BGG | Feeds RSS
Geekdo, BoardGameGeek, the Geekdo logo, and the BoardGameGeek logo are trademarks of BoardGameGeek, LLC.