All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Hawks and Doves (Posted on 2004-09-13)
Whenever a hawk meets a dove, the dove is killed. Whenever two hawks meet, they fight to death, and both are killed. And if two doves meet, nothing bad happens.

There are H hawks and D doves, and you are either a hawk or a dove. Assuming that meetings are random, what are your chances of survival?

 See The Solution Submitted by Federico Kereki Rating: 3.5000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re(3): To Make Oskar's Solution Work... | Comment 13 of 22 |
(In reply to re(2): To Make Oskar's Solution Work... by David Shin)

You are correct.  The revised program now takes into consideration that dove/dove encounters do not lose a dove:

5   Num=8
10   dim P(2,Num)
20   for D=1 to Num:P(1,D)=1:next:' zero hawks
30   for H=2 to Num step 2
40     P2h=H*(H-1)//((H+1)*H)
50     P(2,1)=P2h*P(1,1)
51   print P(2,1);
60     for D=2 to Num
70       P2h=H*(H-1)//((H+D)*(H+D-1))
71       P2d=D*(D-1)//((H+D)*(H+D-1))
80       P(2,D)=(P2h*P(1,D)+(1-P2h-P2d)*(D-1)//D*P(2,D-1))//(1-P2d)
85       print P(2,D);
90     next
95     print
97   for D=1 to Num:P(1,D)=P(2,D):next
100   next

` 1//3  1//3  1//3  1//3  1//3  1//3  1//3  1//3  1//3  1//3 1//5  1//5  1//5  1//5  1//5  1//5  1//5  1//5  1//5  1//5 1//7  1//7  1//7  1//7  1//7  1//7  1//7  1//7  1//7  1//7 1//9  1//9  1//9  1//9  1//9  1//9  1//9  1//9  1//9  1//9 1//11  1//11  1//11  1//11  1//11  1//11  1//11  1//11  1//11  1//11`

 Posted by Charlie on 2004-09-13 20:22:03

 Search: Search body:
Forums (0)