Problem 1260. RISK board game battle simulation
Can you double check your values, Jeremy? I've run your sims against a couple of on-line Risk calculators, and they're coming up with different values for some of your test cases. For example, the one at http://recreationalmath.com/Risk/ using 10 attackers and 10 defenders comes up with 0.47993525647768026, which doesn't meet your error criteria.
Thanks, James, you were right - I generated the values myself with a Matlab script. Unfortunately I did not do enough simulations - 10000 doesn't always get within 1% accuracy. Have updated them all now and rescored all solutions too.
Your solution is now the leading solution btw :)
I didn't submit a solution yet...mainly because I couldn't match up your test values and wanted to make sure that the problem wasn't on my end. (Most of the time, it is! :-)
I've got a working submission now, but you'll need to check the high end of the size chart for it. As usual, Richard and Alfnie are far more clever than I.
James, you give me too much credit. The next ot best solution was a very minor tweak to Jeremy's random solver. My larger solutions, 250, find the exact solution recursively.
James, your speed is impacted by recalculating previously evaluated cases. A case of 100 v 100 finished in ??
You're correct. It is inefficient with super-large armies. I was going for an exact solution (which was an offshoot of the original problems I had with the test suite), and recursion seemed to be the best way to do it.
As our resident "Get this problem to run faster" expert, do you think setting up a global m-by-n matrix with previously calculated probabilities would help things?
suggest writing script to produce testsuite of more cases to paste into cody
Yes, I am enlarging the test suite. Thanks for the input!
Problem Recent Solvers27
Find the alphabetic word product
What is the distance from point P(x,y) to the line Ax + By + C = 0?
Unique values without using UNIQUE function
More from this Author7
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!