# Emprworm's Riddle #17: Mess of Tokens

## Recommended Posts

zamboe, please see the utility that will prove the numbers. In fact, here is the code I use. As you can see this code is totally reliable.

'Create some variables

Dim a

Dim b

Dim a1

Dim b1

Dim count

Dim total

Dim win(2) ' array to hold our wins

Dim ct

total = Val(txttotal.Text) 'total games played entered by web user

win(1) = 0 'the wins of player 1 totaled here

win(2) = 0 'wins of player 2 totaled here

If total < 1 Or total > 1000000 Then txt1.Value = txt1.Value & vbCrLf & "You specified an invalid amount of games to play. Please enter between 0 and 1 million)" : Exit Sub

a = Val(txta.Text) 'the percentage the webuser entered for player A

b = Val(txtb.Text) 'the percentage for player B

If a < 0 Or a > 100 Or b < 0 Or b > 100 Then txt1.Value = txt1.Value & vbCrLf & "You specified an invalid percentage. Ensure that both player A and player B have numbers between 0 and 100." : Exit Sub

Randomize() 'set our random number generator based upon the system time (default setting)

For count = 1 To total

ct = 0

Do

a1 = CInt(Int((100 * Rnd()) + 1)) 'pick a random number between 1 and 100

If a1 < a + 1 Then

dead = 1 'if the random number we just chose is less than or equal to the percentage chance he has to hit (entered by the webuser), then he gets a HIT and a win- game over

win(1) = win(1) + 1 'player 1 just got a hit and a win.

If total = 1 Then txt1.Value = txt1.Value & vbCrLf & "Player 1 = " & a1 & " = HIT! Annihilation. Game Over"

Else

ct = ct + 1

If total = 1 Then txt1.Value = txt1.Value & vbCrLf & "Player 1 = " & a1 & " = miss! "

b1 = CInt(Int((100 * Rnd()) + 1))

If b1 < b + 1 Then

win(2) = win(2) + 1 'player 2 just got a hit and a win

If total = 1 Then txt1.Value = txt1.Value & vbCrLf & "Player 2 = " & b1 & " =...KAPOW! Dead meat for player 1. Game over."

End If

If total = 1 And dead = 0 Then txt1.Value = txt1.Value & vbCrLf & "Player 2 = " & b1 & " miss!"

End If

ct = ct + 1

Loop Until dead = 1 ' keep doing this until someone gets a hit. once dead is equal to one, that means someone got a hit.

If total = 1 Then txt1.Value = txt1.Value & vbCrLf & vbCrLf & "Total turns taken = " & ct

Next 'now we do another game until we reach the amount specified by the TOTAL variable

txt1.Value = txt1.Value & vbCrLf & "Total wins for Player 1 = " & win(1)

txt1.Value = txt1.Value & vbCrLf & "Total wins for Player 2 = " & win(2)

http://www.songwave.com/WebApplication1/compute.aspx

enter 50/50 for both players and you will see that player 1 wins 66% of the time!!!!

you can run it a million times, zamboe.

##### Share on other sites

Emprworm, the code itself seems right, however the math and statistics concepts that applies in my view are wrong.

I will ask you the same question, are you sure your all odds of your results give a total of 100%, don't take a particular case, when i ask that i mean :

The odds of R1 being killed.

The odds of R1 surviving.

The odds of R2 being killed.

The odds of R2 surviving.

The odds of R3 being killed.

The odds of R3 surviving.

When you calculate all those odds, in percentage, then add every one of them if the result is 100%, then you are right, otherwise, as I think you are wrong.

I calculated the odds of those cases, when i made the decision tree to see which part gave me a max value, and I tell you it's 10.5% not more, and the result of all those odds is 100%.

When you say 46,3% the number itself is curious because it only gives 53+% to more than 10 other combinations.

##### Share on other sites

zamboe, it depends upon the permeatation. It totally depends upon different moves that may or may not occur. And they all add up to 100. I'm not too sure what you are getting at, so lets walk through this:

We can calculate the odds of R1 surviving if R2 hits R3, which are completely different from the odds of R1 if R2 misses R3.

1 at a time would be like this:

R1 goes first. There are 3 possible outcomes:

R1 hits R2

R1 hits R3

R1 misses (hits nothing)

Scenario 1:

If R1 hits R2, then the probability of R1 surviving is 0%, the probability of R3 surviving is 100%. The probability for R2 surviving is 0. This adds up to 100.

Scenario 2:

If R1 hits R3, then the probability of R1 surviving is 3/13, or 23%. The probability of R2 surviving is 10/13 or 77%. The probability for R3 is 0. This adds up to 100.

Scenario 3: If R1 MISSES his first shot we now branch off into 2 more possible scenarios:

Scenario 3A: R2 HITS R3.

In this case, R1 will fire next at R2. R1's probability to survive is now 46%, and R2 has 54%. R3's probability is 0. THis adds up to 100.

Scenario 3B: R2 MISSES R3.

In this case, R3 will fire at R2 and kill R2. R1 then has a one time shot to kill R3, giving R1 a 30% chance, and R3 a 70% chance. R2 has a 0% chance of surviving. THis also adds up to 100.

So, since the problem said "Assume that all robots will strategize to win" we can assume that they will take the BEST ODDS.

Therefore, we know empirically that the best odds for R1 are making a deliberate MISS.

In this case, R2 will hit 50% of the time, so total best odds for R1 is the average between scenarios 3A and 3B or (30 + 46) /2 =

R2 would be (54 + 0) / 2 = 27%

R3 would be (70 + 0) / 2 = 35%

TOTAL ODDS FOR R1 WHEN R1 MISSES FIRST SHOT: 38%

TOTAL ODDS FOR R2 WHEN R1 MISSES FIRST SHOT: 27%

TOTAL ODDS FOR R3 WHEN R1 MISSES FIRST SHOT: 35%

this, of course, adds up to precisely 100%

Amazing that if R1 MISSES his first shot, he has the BEST chance at winning!

THis is truly an amazing riddle. Very hard, yes, but unbelievably stunning in its answer!!!

##### Share on other sites

Scenario 3A: R2 HITS R3.

In this case, R1 will fire next at R2. R1's probability to survive is now 46%, and R2 has 54%. R3's probability is 0. THis adds up to 100.

My calculus give me a diferent value of 46%, how do you get it ?. It should be 21%.

The scenario way, it's just the way i made the decision tree, so I think i can follow up you, just tell me how u got those numbers.

##### Share on other sites

The actual equation in calculus to add the infinite sum of probabilities is

"S=a/(1-n)"

The probability string for a duel between R2 and R1 with R2 going first looks like this:

H = .5

MH = .5 * .3 = .15

MMH = .5 * .7 * .5 = .175

MMMH = .5 * .7 * .5 * .3 = .0525

MMMMH = .5 * .7 * .5 * .7 * .5 = .06125

MMMMMH = .5 * .7 * .5 * .7 * .5 * .3 = .018375

##### Share on other sites

The actual equation in calculus to add the infinite sum of probabilities is

"S=a/(1-n)"

The probability string for a duel between R2 and R1 with R2 going first looks like this:

H = .5

MH = .5 * .3 = .15

MMH = .5 * .7 * .5 = .175

MMMH = .5 * .7 * .5 * .3 = .0525

MMMMH = .5 * .7 * .5 * .7 * .5 = .06125

MMMMMH = .5 * .7 * .5 * .7 * .5 * .3 = .018375

I am courious emprworm, please just tell me how you got the 46%, I want to check, maybe I am wrong, so far I think i am right.

##### Share on other sites

OK, for every time you see a "H" for R1, it is = .3

Everytime you see a M for R1, it is = .7 (since with each miss, he has a 70% chance of missing. with each H, it is 30.)

R2 will always be .5 for both H and M

R1 STARTS (r1 is in red)

H = .3

MH = .7 * .5 = .35

MMH = .7 * .5 * .3 = .105

MMMH = .7 * .5 * .7 * .5 = .1225

MMMMH = .7 * .5 * .7 * .5 * .3 = .03675

MMMMMH = .7 * .5 * .7 * .5 * .7 * .5 = .042875

add up the values in red and we are already at 44.175% for R1.

##### Share on other sites

OK, for every time you see a "H" for R1, it is = .3

Everytime you see a M for R1, it is = .7 (since with each miss, he has a 70% chance of missing. with each H, it is 30.)

R2 will always be .5 for both H and M

R1 STARTS (r1 is in red)

H = .3

MH = .7 * .5 = .35

MMH = .7 * .5 * .3 = .105

MMMH = .7 * .5 * .7 * .5 = .1225

MMMMH = .7 * .5 * .7 * .5 * .3 = .03675

MMMMMH = .7 * .5 * .7 * .5 * .7 * .5 = .042875

add up the values in red and we are already at 44.175% for R1.

I don't think is correct.

In my view it is quite more simple. Taking the same scenario 3A:

R1 misses first shoot = 0.7

R2 hits succesfully R3 = 0.5

* At this point the chances of R1 = 0.7*0.5= 35%

R1 hits succesfully R2 = 0.3

Final odd = 0.3*35% = 10.5 %

And adding all the values gives me a total of 100%.

##### Share on other sites

What is with some of these riddles? Who wants to do probability? IMO We should have more abstract creative questions and answers than linear math problems.

##### Share on other sites

zamboe, just cuz they total 100% doesn't make them right. 46 and 54 total 100% too, and that is the correct answer. Not only does it work out on paper as I have shown, but I tested it with my program and did 1 MILLION iterations with the same result.

;D

##### Share on other sites

zamboe, just cuz they total 100% doesn't make them right. 46 and 54 total 100% too, and that is the correct answer. Not only does it work out on paper as I have shown, but I tested it with my program and did 1 MILLION iterations with the same result.

;D

The formula you are using is incorrect, in my view.

You are using a serie, and if you calcule the limit of that serie with

n->infinitum, the result is 1,then the probability is 100%, so it means that the R1 will always stay alive. Doesn't make sense.

Besides, you are adding the odds to get the total odd of R1, the math theory says that when are sucessive events the odds should came from a multiplication (like 0.7*0.5). Those are not parallel events, when the problem is about parallel events only in that casethe odds are to be added.

If you have any source of that puzzle maybe you can check what solution they have, so far I think the solution i provided is correct, however i will email this puzzle to a friend, who is good at it. A third opinion would be benefitial.

##### Share on other sites

I have shown empirically the odds. The formula is 100% correct.

I EVEN GAVE YOU THE EQUATION !

"S=a/(1-n)"

Ok zamboe, since you keep arguing solid math, I'm going to ask something of you. I'm going to ask that YOU provide whatever equation you are using.

Lets simplify this whole thing down to 2 people. 1 guy is flipping a 3 sided die, and the other a two sided coin.

COIN is Side 1, Side 2.

DIE is numbered: 1, 2, 3

Player A has the coin

Player B has the die

goal: first person to roll a 1 wins.

Player A goes first. What are the odds that Player A will win this game?

Now listen Zamboe, what formula are YOU USING to compute this? Its time that you demonstrated your formula, and I will show you the flaw.

Forget the 3 robots. Just focus on player A and Player B. Diagram your decision tree and show me your formulas.

##### Share on other sites

What is with some of these riddles? Who wants to do probability?

well Acriku i will put easier ones up. I liked this riddle because the answer was that R1 should actually deliberately miss, and that gives him higher odds of winning than both of his opponents!

its really a wonderful riddle if you think about how bizzarre the answer is.

##### Share on other sites

wow, i just had no idea the problems this riddle caused :(

I will definately do an easier one next time. Ok zamboe, since you still dispute the results i will try a very basic explanation.

Lets simplify this whole thing down to 2 people. 1 guy is flipping a 3 sided die, and the other a two sided coin.

COIN is Side 1, Side 2.

DIE is numbered: 1, 2, 3

Player A has the coin

Player B has the die

goal: first person to throw a 1 wins.

Player A goes first. What are the odds that Player A will win this game?

Because I care, I will try to explain this as fundamental as I can, but I warn you that if you cannot understand this explanation, then theres nothing else I can do.

Well after 1 turn, player A has a 50% chance of winning with only 2 possible rolls:

1

2

Player B cannot win after just 1 turn, he can only lose (since he hasn't rolled yet)

At the second turn, there are 6 possible rolls:

1 1

1 2

1 3

2 1

2 2

2 3

out of those 6 possible outcomes, player A will win 3 of them. Player B wins only 1.

So after 2 turns, the odds for Player A is 3/6 or 50%, the odds for Player B is 1/6 or 16.667%

Lets do 3 turns. Here is where it gets more fun. First player A, then B, then A again.

What are the odds that Player A will win this game with ONLY 3 turns? So player A goes, then B, then A again and the game STOPS- even if no one rolled a 1.

Player A can roll: 1 2

Player B can roll: 1 2 3

Here are the total possible combinations for 3 turns- remember that player A can never roll a 3!

1 1 1

1 2 1

1 3 1

1 1 2

1 2 2

1 3 2

2 1 1

2 1 2

2 2 1

2 2 2

2 3 1

2 3 2

Now, the first number in each set is what player A rolled, the second number is what player B rolled, and the third is what Player A rolled.

We know that a number 1 wins the game. SO, out of those twelve possible rolls, how many games did Player A win?

Just count them up, Zamboe.

Well he obviously wins 6 of them in the first roll. out of the other 6, he wins 2 more. So he wins 8 out of 12 times. that is a percentage of 2/3 or 66.66%

So with just 3 turns, player A has a 66% chance of winning. Player B has just a 2/12 (1/6) chance or 15%.

Does this add up to 100? NO!! IT CANT. IT ISNT SUPPOSED TOO!

it ONLY adds up to 100 after an infinite sum has been computed.

As you do more and more turns, player A's odds will move to 75% and player B's odds move up to 25%

after 3 turns:

H = .5

MH = .5 * (1/3) = .16667

MMH = .5 * (2/3) * .5 = .166667

Total odds for Player A so far = .5 + .166667 or 2/3

Total odds for player B so far = .16667 or 1/6

This is 100% undeniably correct.

You can manually compute more iterations. For 4 turns, there are 36 possible outcomes.

want a map? Sure.

1.

##### Share on other sites

OK. Here's an easy one! I know someone is gonna get this.

GOOD LUCK!

EMPRWORM'S RIDDLE #7

Most Unique (solved)

Look at the images below. Which one of them is most unique? ##### Share on other sites

[hide]

it is #3 becasue it has the most sides

or # 2 because no backround color

or, #2 because it sticks out more towars the veiwer

[/hide]

also, edric o, do your eyes flash red every so often. it freaks me out.

##### Share on other sites

ok here is what i will not give credit to:

since there are only 5 options, anyone that has an answer that says "blah blah" OR "blah blah" OR "blah blah" will be automatically wrong.

Obviously someone could answer: "it is 1, 2, 3, 4 or 5 for these reasons....blah blah"

The ONLY answer i will except is a definitive answer from someone that has a full explanation that is not a guess, but a sure thing.

I am being strict because this riddle is so much easier.

good luck!

:)

##### Share on other sites

ok sorry, i was wondering that, but since other people had multiple guesses, over a span of several posts, i fugured it was ok to put guesses in one post, but i will be a good boy now. ;D

##### Share on other sites

ya, i didnt mind the guessing answers on the hard riddles. that robot duel took up like 3 pages of math spam. what a headache!

##### Share on other sites

you may or may not have the answer right. people that have the right answer, but not a good enough reason will still have it wrong.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible. ×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.