Page 3 of 3
Posted: Fri Aug 11, 2006 2:09 pm
by joeluchoa
I got AC now!
Thanks a lot Martin Macko!

Posted: Fri Aug 11, 2006 4:17 pm
by Martin Macko
joeluchoa wrote:I got AC now!
Thanks a lot Martin Macko!

After having got AC, please, remove your code from the post above.
Posted: Sun Aug 20, 2006 5:52 pm
by Towhid
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.
Posted: Tue Aug 22, 2006 12:06 pm
by shanto86
well... i cant understand this problem clearly. can any one help?
for example, if attacker had 1 army and defender 1 then, probablity of losing:
(1 + 2 + 3 + 4 + 5 + 6)/6^2 = 21/36 > .5
when attacker 2 and defender 1, probab of losing:
(1^2 + ...+ 6^2)/6^3 = 91/216 < .5 hence winning prob > .5
then how can the output be 3?
one more thing, say A = 4 D = 1, what is the probablity for winning for A?
Posted: Tue Aug 22, 2006 1:19 pm
by Towhid
You cannot use all your army in attack. Read
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?????
Posted: Tue Aug 22, 2006 3:03 pm
by shanto86
yap i got that!
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?
the process will go on in this style?
Posted: Tue Aug 22, 2006 3:47 pm
by shanto86
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)?
Posted: Wed Aug 23, 2006 6:20 am
by shanto86
please help some one, i cant understand where is the mistake. it does not give correct output for 5.
Posted: Wed Aug 23, 2006 11:05 am
by shanto86
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.
Mahbub
Posted: Wed Aug 23, 2006 2:23 pm
by Towhid
1. no it is not necessary to send 3 armies always. they are the best possible player so they both plays optimally.
Is it? But the problem statement says:
It
Posted: Thu Aug 24, 2006 1:45 am
by shanto86
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
Posted: Mon Aug 28, 2006 2:24 pm
by Towhid
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.........