11061 - Playing War

All about problems in Volume 110. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

joeluchoa
New poster
Posts: 28
Joined: Sat Jul 31, 2004 12:11 am
Location: Brasil

Post by joeluchoa »

I got AC now!
Thanks a lot Martin Macko!

:D

Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Post by Martin Macko »

joeluchoa wrote:I got AC now!
Thanks a lot Martin Macko!

:D
After having got AC, please, remove your code from the post above.

Towhid
New poster
Posts: 38
Joined: Wed May 28, 2003 5:30 pm
Location: Bangladesh
Contact:

Post 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.
From 0 to 0

shanto86
Experienced poster
Posts: 160
Joined: Wed Jul 30, 2003 8:10 pm

Post 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?
Self judging is the best judging!

Towhid
New poster
Posts: 38
Joined: Wed May 28, 2003 5:30 pm
Location: Bangladesh
Contact:

Post 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?????
From 0 to 0

shanto86
Experienced poster
Posts: 160
Joined: Wed Jul 30, 2003 8:10 pm

Post 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?
Self judging is the best judging!

shanto86
Experienced poster
Posts: 160
Joined: Wed Jul 30, 2003 8:10 pm

Post 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)?
Self judging is the best judging!

shanto86
Experienced poster
Posts: 160
Joined: Wed Jul 30, 2003 8:10 pm

Post by shanto86 »

please help some one, i cant understand where is the mistake. it does not give correct output for 5.

Code: Select all

AC
Last edited by shanto86 on Wed Aug 23, 2006 11:06 am, edited 1 time in total.
Self judging is the best judging!

shanto86
Experienced poster
Posts: 160
Joined: Wed Jul 30, 2003 8:10 pm

Post 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
Self judging is the best judging!

Towhid
New poster
Posts: 38
Joined: Wed May 28, 2003 5:30 pm
Location: Bangladesh
Contact:

Post 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
From 0 to 0

shanto86
Experienced poster
Posts: 160
Joined: Wed Jul 30, 2003 8:10 pm

Post 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
Self judging is the best judging!

Towhid
New poster
Posts: 38
Joined: Wed May 28, 2003 5:30 pm
Location: Bangladesh
Contact:

Post 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.........
From 0 to 0

Post Reply

Return to “Volume 110 (11000-11099)”