Please help me to figure out the chance of success of a game

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Nay Lin Tun
Posts: 708
Joined: Mon Jan 16, 2012 6:34 am

Please help me to figure out the chance of success of a game

Post by Nay Lin Tun »

Hi everyone,

It is not about talking chess but i would like to ask a favour to figure out the probability of a game that i am playing because I saw there are a lot of good mathematicians here. Four objects hit a target subsequently that has hit points 100. A single hit will damage hit point between 20-35 randomly. You need to hit 101 points and above to damage the object completely. The randomness is if you are very lucky, you can finish the mission with only 3, but if you are very unlucky u even even miss the mission with 4. My question is the chance of success for completing the mission with 4 hits. Also the chance if u can miss with even 4, and the chance you can win with even 3.

Thanks in advance,
Nay
voyagerOne
Posts: 154
Joined: Tue May 17, 2011 8:12 pm

Re: Please help me to figure out the chance of success of a

Post by voyagerOne »

Probability of number of hits to destroy target:


3: 0.00854492
4: 0.83358765
5: 0.15786648
6: 0.00000095
Nay Lin Tun
Posts: 708
Joined: Mon Jan 16, 2012 6:34 am

Re: Please help me to figure out the chance of success of a

Post by Nay Lin Tun »

Thanks a lot, Bill, really appreciate it.
User avatar
Ajedrecista
Posts: 1971
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Please help me to figure out the chance of success of a game

Post by Ajedrecista »

Hello:

First of all, sorry for this long post.

This thread (the part of generating functions) brought me an idea to work on:

Code: Select all

1/(35 - 20 + 1) = 1/16 (because there are 16 possible outcomes):

20 21 22 23
24 25 26 27
28 29 30 31
32 33 34 35

{[(1/16)^(hits)]*(x^20 + x^21 + ... + x^34 + x^35)}^(hits)

Getting rid of (1/16)^(hits) factor at first:

(x^20 + x^21 + ... + x^34 + x^35)}^(hits)

Code: Select all

http://www.solvemymath.com/online_math_calculator/algebra_combinatorics/polynomial_calculator/polynomial_mul_div.php

Hits = 1:
f_1(x) = x^20 + x^21 + x^22 + x^23 + x^24 + x^25 + x^26 + x^27 + x^28 + x^29 + x^30 + x^31 + x^32 + x^33 + x^34 + x^35

Hits = 2:
f_2(x) = x^40 + 2x^41 + 3x^42 + 4x^43 + 5x^44 + 6x^45 + 7x^46 + 8x^47 + 9x^48 + 10x^49 + 11x^50 + 12x^51 + 13x^52 + 14x^53 + 15x^54 + 16x^55 + 15x^56 + 14x^57 + 13x^58 + 12x^59 + 11x^60 + 10x^61 + 9x^62 + 8x^63 + 7x^64 + 6x^65 + 5x^66 + 4x^67 + 3x^68 + 2x^69 + x^70

Hits = 3:
f_3(x) = x^105 + 3x^104 + 6x^103 + 10x^102 + 15x^101 + 21x^100 + 28x^99 + 36x^98 + 45x^97 + 55x^96 + 66x^95 + 78x^94 + 91x^93 + 105x^92 + 120x^91 + 136x^90 + 150x^89 + 162x^88 + 172x^87 + 180x^86 + 186x^85 + 190x^84 + 192x^83 + 192x^82 + 190x^81 + 186x^80 + 180x^79 + 172x^78 + 162x^77 + 150x^76 + 136x^75 + 120x^74 + 105x^73 + 91x^72 + 78x^71 + 66x^70 + 55x^69 + 45x^68 + 36x^67 + 28x^66 + 21x^65 + 15x^64 + 10x^63 + 6x^62 + 3x^61 + x^60

Hits = 4:
f_4(x) = x^140 + 4x^139 + 10x^138 + 20x^137 + 35x^136 + 56x^135 + 84x^134 + 120x^133 + 165x^132 + 220x^131 + 286x^130 + 364x^129 + 455x^128 + 560x^127 + 680x^126 + 816x^125 + 965x^124 + 1124x^123 + 1290x^122 + 1460x^121 + 1631x^120 + 1800x^119 + 1964x^118 + 2120x^117 + 2265x^116 + 2396x^115 + 2510x^114 + 2604x^113 + 2675x^112 + 2720x^111 + 2736x^110 + 2720x^109 + 2675x^108 + 2604x^107 + 2510x^106 + 2396x^105 + 2265x^104 + 2120x^103 + 1964x^102 + 1800x^101 + 1631x^100 + 1460x^99 + 1290x^98 + 1124x^97 + 965x^96 + 816x^95 + 680x^94 + 560x^93 + 455x^92 + 364x^91 + 286x^90 + 220x^89 + 165x^88 + 120x^87 + 84x^86 + 56x^85 + 35x^84 + 20x^83 + 10x^82 + 4x^81 + x^80

Hits = 5:
f_5(x) = x^175 + 5x^174 + 15x^173 + 35x^172 + 70x^171 + 126x^170 + 210x^169 + 330x^168 + 495x^167 + 715x^166 + 1001x^165 + 1365x^164 + 1820x^163 + 2380x^162 + 3060x^161 + 3876x^160 + 4840x^159 + 5960x^158 + 7240x^157 + 8680x^156 + 10276x^155 + 12020x^154 + 13900x^153 + 15900x^152 + 18000x^151 + 20176x^150 + 22400x^149 + 24640x^148 + 26860x^147 + 29020x^146 + 31076x^145 + 32980x^144 + 34690x^143 + 36170x^142 + 37390x^141 + 38326x^140 + 38960x^139 + 39280x^138 + 39280x^137 + 38960x^136 + 38326x^135 + 37390x^134 + 36170x^133 + 34690x^132 + 32980x^131 + 31076x^130 + 29020x^129 + 26860x^128 + 24640x^127 + 22400x^126 + 20176x^125 + 18000x^124 + 15900x^123 + 13900x^122 + 12020x^121 + 10276x^120 + 8680x^119 + 7240x^118 + 5960x^117 + 4840x^116 + 3876x^115 + 3060x^114 + 2380x^113 + 1820x^112 + 1365x^111 + 1001x^110 + 715x^109 + 495x^108 + 330x^107 + 210x^106 + 126x^105 + 70x^104 + 35x^103 + 15x^102 + 5x^101 + x^100

Hits = 6:
f_6(x) = x^210 + 6x^209 + 21x^208 + 56x^207 + 126x^206 + 252x^205 + 462x^204 + 792x^203 + 1287x^202 + 2002x^201 + 3003x^200 + 4368x^199 + 6188x^198 + 8568x^197 + 11628x^196 + 15504x^195 + 20343x^194 + 26298x^193 + 33523x^192 + 42168x^191 + 52374x^190 + 64268x^189 + 77958x^188 + 93528x^187 + 111033x^186 + 130494x^185 + 151893x^184 + 175168x^183 + 200208x^182 + 226848x^181 + 254864x^180 + 283968x^179 + 313818x^178 + 344028x^177 + 374178x^176 + 403824x^175 + 432508x^174 + 459768x^173 + 485148x^172 + 508208x^171 + 528534x^170 + 545748x^169 + 559518x^168 + 569568x^167 + 575688x^166 + 577744x^165 + 575688x^164 + 569568x^163 + 559518x^162 + 545748x^161 + 528534x^160 + 508208x^159 + 485148x^158 + 459768x^157 + 432508x^156 + 403824x^155 + 374178x^154 + 344028x^153 + 313818x^152 + 283968x^151 + 254864x^150 + 226848x^149 + 200208x^148 + 175168x^147 + 151893x^146 + 130494x^145 + 111033x^144 + 93528x^143 + 77958x^142 + 64268x^141 + 52374x^140 + 42168x^139 + 33523x^138 + 26298x^137 + 20343x^136 + 15504x^135 + 11628x^134 + 8568x^133 + 6188x^132 + 4368x^131 + 3003x^130 + 2002x^129 + 1287x^128 + 792x^127 + 462x^126 + 252x^125 + 126x^124 + 56x^123 + 21x^122 + 6x^121 + x^120
Once the number of hits is enough to reach 101 points or more, I truncate the polynomials and I multiply by f_1(x), this is, like hitting again. The objective is not sum another hit if 101 or more points were already reached:

Code: Select all

Truncation of f_hits(x) = [f_hits(x)]_t = x^(20*hits) + hits*x^(20*hits + 1) + ... + coefficient*x^100

Hits = 3:
f_3(x) = x^105 + 3x^104 + 6x^103 + 10x^102 + 15x^101 + 21x^100 + 28x^99 + 36x^98 + 45x^97 + 55x^96 + 66x^95 + 78x^94 + 91x^93 + 105x^92 + 120x^91 + 136x^90 + 150x^89 + 162x^88 + 172x^87 + 180x^86 + 186x^85 + 190x^84 + 192x^83 + 192x^82 + 190x^81 + 186x^80 + 180x^79 + 172x^78 + 162x^77 + 150x^76 + 136x^75 + 120x^74 + 105x^73 + 91x^72 + 78x^71 + 66x^70 + 55x^69 + 45x^68 + 36x^67 + 28x^66 + 21x^65 + 15x^64 + 10x^63 + 6x^62 + 3x^61 + x^60

Hits = 4:
[f_3(x)]_t = 21x^100 + 28x^99 + 36x^98 + 45x^97 + 55x^96 + 66x^95 + 78x^94 + 91x^93 + 105x^92 + 120x^91 + 136x^90 + 150x^89 + 162x^88 + 172x^87 + 180x^86 + 186x^85 + 190x^84 + 192x^83 + 192x^82 + 190x^81 + 186x^80 + 180x^79 + 172x^78 + 162x^77 + 150x^76 + 136x^75 + 120x^74 + 105x^73 + 91x^72 + 78x^71 + 66x^70 + 55x^69 + 45x^68 + 36x^67 + 28x^66 + 21x^65 + 15x^64 + 10x^63 + 6x^62 + 3x^61 + x^60
{[f_3(x)]_t}*[f_1(x)] = 21x^135 + 49x^134 + 85x^133 + 130x^132 + 185x^131 + 251x^130 + 329x^129 + 420x^128 + 525x^127 + 645x^126 + 781x^125 + 931x^124 + 1093x^123 + 1265x^122 + 1445x^121 + 1631x^120 + 1800x^119 + 1964x^118 + 2120x^117 + 2265x^116 + 2396x^115 + 2510x^114 + 2604x^113 + 2675x^112 + 2720x^111 + 2736x^110 + 2720x^109 + 2675x^108 + 2604x^107 + 2510x^106 + 2396x^105 + 2265x^104 + 2120x^103 + 1964x^102 + 1800x^101 + 1631x^100 + 1460x^99 + 1290x^98 + 1124x^97 + 965x^96 + 816x^95 + 680x^94 + 560x^93 + 455x^92 + 364x^91 + 286x^90 + 220x^89 + 165x^88 + 120x^87 + 84x^86 + 56x^85 + 35x^84 + 20x^83 + 10x^82 + 4x^81 + x^80

Hits = 5:
[f_4(x)]_t = 1631x^100 + 1460x^99 + 1290x^98 + 1124x^97 + 965x^96 + 816x^95 + 680x^94 + 560x^93 + 455x^92 + 364x^91 + 286x^90 + 220x^89 + 165x^88 + 120x^87 + 84x^86 + 56x^85 + 35x^84 + 20x^83 + 10x^82 + 4x^81 + x^80
{[f_4(x)]_t}*[f_1(x)] = 1631x^135 + 3091x^134 + 4381x^133 + 5505x^132 + 6470x^131 + 7286x^130 + 7966x^129 + 8526x^128 + 8981x^127 + 9345x^126 + 9631x^125 + 9851x^124 + 10016x^123 + 10136x^122 + 10220x^121 + 10276x^120 + 8680x^119 + 7240x^118 + 5960x^117 + 4840x^116 + 3876x^115 + 3060x^114 + 2380x^113 + 1820x^112 + 1365x^111 + 1001x^110 + 715x^109 + 495x^108 + 330x^107 + 210x^106 + 126x^105 + 70x^104 + 35x^103 + 15x^102 + 5x^101 + x^100

Hits = 6:
[f_5(x)]_t = x^100
{[f_5(x)]_t}*[f_1(x)] = x^135 + x^134 + x^133 + x^132 + x^131 + x^130 + x^129 + x^128 + x^127 + x^126 + x^125 + x^124 + x^123 + x^122 + x^121 + x^120
The next step is sum all the coefficients of {[f_(hits - 1)(x)]_t}*[f_1(x)] that multiply x^k, where k > 100; then divide by 16^(hits) and these are the probabilities requested by Nay. By the way: what game is that?

Code: Select all

Hits = 3:
(1 + 3 + 6 + 10 + 15)/(16^3) = 35/4096 ~ 0.008544921875

Hits = 4:
(21 + 49 + 85 + 130 + 185 + 251 + 329 + 420 + 525 + 645 + 781 + 931 + 1093 + 1265 + 1445 + 1631 + 1800 + 1964 + 2120 + 2265 + 2396 + 2510 + 2604 + 2675 + 2720 + 2736 + 2720 + 2675 + 2604 + 2510 + 2396 + 2265 + 2120 + 1964 + 1800)/(16^4) = 54630/65536 ~ 0.833587646484

Hits = 5:
(1631 + 3091 + 4381 + 5505 + 6470 + 7286 + 7966 + 8526 + 8981 + 9345 + 9631 + 9851 + 10016 + 10136 + 10220 + 10276 + 8680 + 7240 + 5960 + 4840 + 3876 + 3060 + 2380 + 1820 + 1365 + 1001 + 715 + 495 + 330 + 210 + 126 + 70 + 35 + 15 + 5)/(16^5) = 165535/1048576 ~ 0.157866477966

Hits = 6:
(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1)/(16^6) = 16/16777216 ~ 0.000000953674

Code: Select all

Of course:

35/4096 + 54630/65536 + 165535/1048576 + 16/16777216 = 1
Bill's results are confirmed. I wonder how he reached the solution. I am sure that he did it in a much easier way.

Regards from Spain.

Ajedrecista.
Nay Lin Tun
Posts: 708
Joined: Mon Jan 16, 2012 6:34 am

Re: Please help me to figure out the chance of success of a

Post by Nay Lin Tun »

Hi Jesus, The game is Tribal wars 2 {https://en.tribalwars2.com/page#/}. Now I see that the formula is much harder than expected and I dont feel guilty to myself that I was unable to solve with my basic maths . My guess for chance of success with four hits is around 85-90% , but I dont know how to find out a functional formula to calculate it. . And also there is a tiny percentage (one in million) that you can even miss the mission with 5 hits. :lol: :
User avatar
Ajedrecista
Posts: 1971
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Please help me to figure out the chance of success of a game

Post by Ajedrecista »

Hello:
Ajedrecista wrote:

Code: Select all

{[(1/16)^(hits)]*(x^20 + x^21 + ... + x^34 + x^35)}^(hits)

Getting rid of (1/16)^(hits) factor at first:

(x^20 + x^21 + ... + x^34 + x^35)}^(hits)
There is a typo at the start of my other post. However, the polynomials and results are fine. The true formula is:

Code: Select all

[(1/16)*(x^20 + x^21 + ... + x^34 + x^35)]^(hits) = [(1/16)^(hits)]*(x^20 + x^21 + ... + x^34 + x^35)}^(hits)
I wrongly wrote {[(1/16)^(hits)]*[...]}^(hits) when it is {(1/16)*[...]}^(hits). Sorry for bump this topic for this mistake but I wanted to correct it.

Regards from Spain.

Ajedrecista.
Uri Blass
Posts: 10314
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Please help me to figure out the chance of success of a

Post by Uri Blass »

I think that the easiest way to solve this type of problems is by a computer program bacuase otherwise you need to do hundrends of calculations by hand and in the general case more calculations if you are interested in the probability to destroy the target by more hits when you need more points to destroy the target.

Define f(n,k) the probability to get n points in k hits
and after you calculate all value of f(n,k-1) you have
f(n,k)=sum of f(n-35+j,k-1)*1/16 for all 0<=j<=15

You need to calculate f(n,k) only for 20k<=n<=35k
so you have 16k calculations for every k.

sum of f(n,k) for n>=101 is the probability to destroy the target with at most k hits.
sum of f(n,k-1) for n>=101 is the probability to destroy the target with at most k-1 hits.

The difference is exactly the probability to destroy the target with exactly k hits.