A little riddle - Page 3

A little riddle

Post just about everything that isn't directly related to Spring here!

Moderator: Moderators

manored
Posts: 3179
Joined: 15 Nov 2006, 00:37

Re: A little riddle

Post by manored »

I dont really know the diference between when and then, but as far as I know affirming something doesnt invalidates other possibility...

whats the issue with the other riddle?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: A little riddle

Post by lurker »

when - at the same time as
then - afterwards

The issue with the other riddle is that it was unclear whose disk the second person looked at. 'last' could mean the final man to be tested, but then you refer to the final man as 'third' seconds later, which makes it seem like 'last' is to be interpreted the other way, as 'previous'.
PRO_rANDY
Posts: 314
Joined: 17 Jul 2006, 01:06

Re: A little riddle

Post by PRO_rANDY »

i didnt read any replies but u shud change for a 2/3 chance to win. EZ game
manored
Posts: 3179
Joined: 15 Nov 2006, 00:37

Re: A little riddle

Post by manored »

lurker wrote:when - at the same time as
then - afterwards

The issue with the other riddle is that it was unclear whose disk the second person looked at. 'last' could mean the final man to be tested, but then you refer to the final man as 'third' seconds later, which makes it seem like 'last' is to be interpreted the other way, as 'previous'.
Dam grammar :)

"the second could only see the one from the last man and know that the first had missed, but also failed." I think in this part leaves it is quite clear that the last man is diferent from the first, else I would have said "and know he had missed" instead of "and know the first had missed"
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: A little riddle

Post by lurker »

manored wrote:I would have said "and know he had missed" instead of "and know the first had missed"
Good point.
tombom
Posts: 1933
Joined: 18 Dec 2005, 20:21

Re: A little riddle

Post by tombom »

Oh and also bibim's second thing it now doesn't matter which you choose. I can't remember why but I know that having the host know which doors are which is a very important part of why the "normal" version is 2/3 for switching.
User avatar
SwiftSpear
Classic Community Lead
Posts: 7287
Joined: 12 Aug 2005, 09:29

Re: A little riddle

Post by SwiftSpear »

tombom wrote:Oh and also bibim's second thing it now doesn't matter which you choose. I can't remember why but I know that having the host know which doors are which is a very important part of why the "normal" version is 2/3 for switching.
The only reason it's important is if the second player is capable winning as well. If the second player always loses he performs absolutely identically to the host who knows which door is empty, and therefore is irrellevant to the simulation. We could modify det's simulation so that the second player chooses randomly and the game drops every instance in which he wins from the statistics. In that case we'll see that the simulation is the same. Since you have a 1/3 chance of winning at the start, and one wrong element is always removed, your chances are always better if you switch.
User avatar
bibim
Lobby Developer
Posts: 959
Joined: 06 Dec 2007, 11:12

Re: A little riddle

Post by bibim »

SwiftSpear wrote:We could modify det's simulation so that the second player chooses randomly and the game drops every instance in which he wins from the statistics. In that case we'll see that the simulation is the same.
I wouldn't be that sure ;)
User avatar
SwiftSpear
Classic Community Lead
Posts: 7287
Joined: 12 Aug 2005, 09:29

Re: A little riddle

Post by SwiftSpear »

bibim wrote:
SwiftSpear wrote:We could modify det's simulation so that the second player chooses randomly and the game drops every instance in which he wins from the statistics. In that case we'll see that the simulation is the same.
I wouldn't be that sure ;)
if the 1/3 of the games the second player wins count then it will significantly change the simulation, if they don't then the simulation remains identical.
User avatar
bibim
Lobby Developer
Posts: 959
Joined: 06 Dec 2007, 11:12

Re: A little riddle

Post by bibim »

SwiftSpear wrote:
bibim wrote:
SwiftSpear wrote:We could modify det's simulation so that the second player chooses randomly and the game drops every instance in which he wins from the statistics. In that case we'll see that the simulation is the same.
I wouldn't be that sure ;)
if the 1/3 of the games the second player wins count then it will significantly change the simulation, if they don't then the simulation remains identical.
No they don't count, as you said before, because it's stated there is nothing behind his door.
User avatar
bibim
Lobby Developer
Posts: 959
Joined: 06 Dec 2007, 11:12

Re: A little riddle

Post by bibim »

I've made a small Perl script to simulate the two riddles. It's clearly not optimized at all, I just wanted to make an easily understandable implementation, nearest as possible from the "real game". Here it is.

And here is the result:

Code: Select all

anonymous@localhost:~$ ./riddles.pl 1
Winning rate when keeping the same door: 33.062
Winning rate when changing door: 66.938

anonymous@localhost:~$ ./riddles.pl 2
Winning rate when keeping the same door: 49.793
Winning rate when changing door: 50.207
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Re: A little riddle

Post by Dragon45 »

good lord det, ocaml?

i should write a brainfuck simulation of this just to spite you
User avatar
SwiftSpear
Classic Community Lead
Posts: 7287
Joined: 12 Aug 2005, 09:29

Re: A little riddle

Post by SwiftSpear »

Perl is a mindfuck...
well... I'm not familiar with the syntax at all, but I can't figure out what's going on either way.

Still... the second problem is no different from the first, knowledge of the correct door is irrelevant if some arbitrary higher entity prevents you from selecting the correct door every time anyways.

The problem is that we're dropping 1 third of our simulations, and in those simulations the player has always selected the wrong door first. So basically, since we have an initial chance of 2/3 to select a wrong door first, but a 50% chance of ending the simulation every time a wrong door is selected, we've altered the simulation in a way the rules didn't explicitly describe... Although it is interesting how that effects the statistics, and it was something I didn't initially suspect, it's still technically breaking our rules since the ignorant player somehow magically fails to select the correct door every time via the riddle, however, our simulation changes that in such that he succeeds most of the time, but we just ignore those instances. Evidently it's not as trivial a difference as I would have initially thought.
User avatar
bibim
Lobby Developer
Posts: 959
Joined: 06 Dec 2007, 11:12

Re: A little riddle

Post by bibim »

SwiftSpear wrote:Still... the second problem is no different from the first, knowledge of the correct door is irrelevant if some arbitrary higher entity prevents you from selecting the correct door every time anyways.
I don't see what you mean :/
SwiftSpear wrote:The problem is that we're dropping 1 third of our simulations, and in those simulations the player has always selected the wrong door first. So basically, since we have an initial chance of 2/3 to select a wrong door first, but a 50% chance of ending the simulation every time a wrong door is selected, we've altered the simulation in a way the rules didn't explicitly describe...
No, we simply are taking into account conditional probabilities... Actually, this is the real difference between the 2 riddles: in the first riddle, we know that the other person will open a bad door even before we choose our first door. So when the other person opens the bad door, it doesn't alter the probability to have chosen the good door initially (1/3). These two events are independent. Whereas in the second riddle, the fact that the door opened by the other guy isn't the good one gives us information. As you explained, he has more chance to open a bad door if we chose the good door initially. These two events are dependent. So the fact that he chose randomly a bad door increases our chance to have the good door to 1/2. That's why we can't simulate these 2 riddles in the same way.
SwiftSpear wrote:Although it is interesting how that effects the statistics, and it was something I didn't initially suspect, it's still technically breaking our rules since the ignorant player somehow magically fails to select the correct door every time via the riddle, however, our simulation changes that in such that he succeeds most of the time, but we just ignore those instances. Evidently it's not as trivial a difference as I would have initially thought.
I don't understand :/ The riddle only speaks about one iteration of the game, and we know that the other guy has opened a bad door. What we are doing in the Perl script is simply performing this game several times, in order to obtain an approximation of the probabilities. But to obtain this approximation we have to be in the exact case of the riddle, i.e: we have to drop iterations where the other guy chooses the good door because in our single case, he chose a bad one...
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Re: A little riddle

Post by Dragon45 »

okay i somehow ended up writing a brainfuck interpreter in python last night

i'll try and write an actual python simulator for the Monty Hall problem sometime later...
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: A little riddle

Post by Kloot »

Python version is trivial: ;)

Code: Select all

import random

numGames    = 10000
gameDoors   = [0, 1, 2]
playerDoors = [0, 1, 2]
switch      = True
wins        = 0
losses      = 0

for i in range(numGames):
	playerDoor = random.choice(gameDoors)
	prizeDoor = random.choice(gameDoors)

	if (playerDoor == prizeDoor):
		gameDoors.remove(prizeDoor)
	else:
		gameDoors.remove(playerDoor)
		gameDoors.remove(prizeDoor)

	hostDoor = random.choice(gameDoors)

	if (switch):
		playerDoors.remove(playerDoor)
		playerDoors.remove(hostDoor)
		playerDoor = playerDoors[0]
		playerDoors = [0, 1, 2]

	if (playerDoor == prizeDoor):
		wins += 1
	else:
		losses += 1

	gameDoors = [0, 1, 2]


winPerc = (float(wins) / numGames) * 100
lossPerc = (float(losses) / numGames) * 100
print "wins: %d (%.2f%%), losses: %d (%.2f%%)" % (wins, winPerc, losses, lossPerc)

Code: Select all

switch = True
python ./MontyHall.py
wins: 6665 (66.65%), losses: 3335 (33.35%)

switch = False
python ./MontyHall.py
wins: 3283 (32.83%), losses: 6717 (67.17%)
Last edited by Kloot on 27 Jun 2008, 00:19, edited 4 times in total.
tombom
Posts: 1933
Joined: 18 Dec 2005, 20:21

Re: A little riddle

Post by tombom »

swiftspear is just _wrong_ and it's depressing that he won't accept this
User avatar
bibim
Lobby Developer
Posts: 959
Joined: 06 Dec 2007, 11:12

Re: A little riddle

Post by bibim »

Kloot wrote:

Code: Select all

	playerDoor = random.choice(gameDoors)
	prizeDoor = random.choice(gameDoors)
	gameDoors.remove(prizeDoor)
	hostDoor = random.choice(gameDoors)
Well, I dont know Python at all, however it seems you forgot to remove the playerDoor from the gameDoors before choosing the hostDoor. Maybe that would explain why you have "win ratio when keeping door" + "win ratio when switching" != 100% ...
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: A little riddle

Post by Kloot »

Oops, nice catch. Post is bugfixed now. ;)
manored
Posts: 3179
Joined: 15 Nov 2006, 00:37

Re: A little riddle

Post by manored »

Just remembered another riddle: There are 2 men, one is the "correct" and the other is the "false". The correct always tells the truth and the false always lies. You must discover who is who, but you can only do so by making a single question that both will answer. What question must you make?
Post Reply

Return to “Off Topic Discussion”