I think now I understand the problem. I had some wrong idea. But now
I have same kind of problem. My code outputs 172 for 100. for 171 the probability is 0.4986... Most of the outputs matches. I have used:
p(m,n)=p1*p(m,n-3)+p2*(m-1,n-2)+p3*(m-2,n-1)+p4*(m-3,n)
where
p1=6420.0/46656.0;
p2=10017.0/46656.0;
p3=12348.0/46656.0;
p4=17871.0/46656.0;
and p(m,n) is the probability of success if attack has m soldier and defend has n soldier.
When attacking, at least one army must remain on the origin territory, so a player with 3 armies can only use 2 of them to attack an adjacent territory. The defense, however, can use all the available number of armies to defend, up to a maximum allowed number of armies.
You must have ony army in your teritory when attack. I couldn't figure out the problem in my solution though. Can anyone check the previous post?????
but well... say A has 100 and D has 100. say 3 from each side in battle field. and say 2 of D is killed and 1 of A. now what will be about the rest of the armies? will the back to their main base? and then new battle begins?
well one more question, say A has 100 and D has 100. then is it possible that in the first battle, A sends 2 and D sends 1 soldier? or it is always compelled to send 3 soldiers for both sides (when for A, >=4 or for D, >=3)?
ok i got AC. it was not that much tough, but to me the tougest part was to compute the base cases. to do so i have written another code to compute the base probablities.
now i can answer my own questions:
1. no it is not necessary to send 3 armies always. they are the best possible player so they both plays optimally.
2. in a battle the undied player will go back to its barrack.
well.. towhid vi, i think u just had not read the next sentence:
[quote]It should not be a surprise that usually each player uses as many armies in a combat as he can, even though the rules allow him to use less. On the other hand, some players are a little bit neurotic and when they start attacking an enemy territory, they don
Well, thanks. A small modification and got AC. The interesting thing is when both side has more than 3 soldiers, then the optimal way is to send most possible of them. However, the statement of the problem should be clearer.........