## Sherwood Showdown: Winner Announced

The winner of the random drawing has been chosen. Turns out it wasn’t you. I know. I’m disappointed too. I really thought you had it. The game should end up in the mail sometime today or tomorrow.

Well, fortune has failed you. However, you can still obtain the game by means of commerce. A brute-force solution, I admit, but it’s less labor-intensive than theft.

For those of you who are curious about how the winner was selected, I will post these quasi-technical details:

The first step is going into the database and tracking down all of the eligible comments. This is problematic because I use mySQL just rarely enough to forget what I’m doing each time. For example:

SELECT FROM wp_comments comment_author, comment_author_email, comment_content WHERE comment_post_ID='12349' AND comment_content REGEXP ('gimmie'); |

I ALWAYS make this mistake. And I always forget that I always make this mistake. And I’m always mystified that I’m getting an error after making this mistake. Then I discover the error. Then I remember making the error last time, and so on. It’s completely ridiculous, and wouldn’t happen at all if I used a database more often than once every nine months.

My wife gives directions like this, and it always leads to those sort of unintentional misunderstandings that keep sitcoms in business after all of these years.

HEATHER: Would you get me something? I need a tiny blue container sitting on the…

Me (to myself): *Okay, she wants a container. Are we talking medicine, or food, or a container for one or the other that’s been re-purposed? There’s a lot of nut tins around here holding screws and coins and…*

HEATHER: …on the left-hand side of the…

Me (to myself): *We’re dealing with the left side of something here, but what? A room? A cupboard. A counter-top?*

HEATHER: …second shelf up…

Me (to myself): *Shelf! So we’re either talking about the bathroom, the kitchen, or the garage. Not the bedroom, living room, or…*

HEATHER: …of the big cabinet in the…

Me (to myself): *Big cabinet? So that means we’re talking about a room with more than one cabinet, and one is larger than the other…*

HEATHER: …kitchen.

Me (to myself): *Kitchen! Got it! So I need to go into the kitchen and get the… crap. What color was the bottle again?*

So it goes. I always expect and give directions beginning with the most general and working to the most specific. My wife (and mySQL) go from specific to to general. I suppose my wife’s way is better if the other person intuits what you’re talking about before you get to the end. You can abort the information transfer and go get the thing directly. It has the disadvantage that all directions are useless until the listener makes that connection, at which point they must play them back in reverse order. Still, both methods have their uses, although it doesn’t explain why mySQL wants to know what fields I want before I tell it what table it should look in.

The correct command is of course:

SELECT comment_author, comment_author_email, comment_content FROM wp_comments WHERE comment_post_ID='12349' AND comment_content REGEXP ('gimmie'); |

This yields a list of 282 entries.

Now I need dice. Yes, I could use mySQL, or a web-based random number generator, or any of the dozens of RNG’s at my disposal, but I promised to use dice for this and that’s what we’re doing. This site is named TWENTY SIDED and I so rarely write about anything that might be remotely affiliated with things that might be remotely connected with that phrase.

This is either an extensive dice collection, or a good start, depending on how long you’ve been gaming. As much as I’d like to throw a huge pile of 20-siders, I think this is a job for 10-siders.

Red will be the hundreds, green is the tens, blue is the ones. If I get a number greater than 282, I’ll modulo the result with 282.

I roll a 236. I open up the results spewed by mySQL and check line #236 for our winner. Done.

Note that the results are final. Even if I did something incorrect, foolish, or idiotic, it was at least *randomly* so.

I must say it’s very strange going through the Sherwood Showdown cards. A lot of these were modeled by people we know, and several were based on sketches of guys from my gaming group. Heather changed the age, haircut, and clothing, but I can still see the original poser showing through in expression and body language. (You hear that, guys? You’re a bunch of posers! Just thought you should know.)

If you’re looking to buy the game: Yes, most international orders are fine. It’s actually cheaper to mail the game from Canada to the Netherlands than to mail from one part of Canada to another. No, I don’t understand why. Once again, here is the order page which, I hasten to remind you, is easier than theft. Even for rogues.

UPDATE: Three people have all pointed out this this was an uneven distribution of odds, no need to say the same thing. The winner fell outside of the “favored” range anyway, so…

I DIDN’T WIN! *Sobs and Sobs*

Not like I asked

Edit: first! This is what I do in my spare time

Hah! Something in programming I have more experience in than Shamus! Victory!

Feels good eh? ;)

Heh. I even gave a SQL statement like that in the comments, though that _did_ make use of the random sort option.

“I really thought you where a shoe-in.” Were, not where.

Shoo-in not shoe-in

“I really thought you were a-shooin'”

“Bless you.”

Fixed!

“Ire ally though tyo uwer EA-shoo in”

:D

Naw, it’s like having a “foot in the door.”

Considering it’s a colloquialism for “sure win”, I think Shamus can spell it however he likes.

It’s not a colloquialism, it’s derived from the noise people make when herding domesticated animals, and refers to a race horse being “shooed” over the finish line in a rigged contest.

You’re sitting in front of the internet. Look it up.

Shamus, I don’t suppose you could tell us (‘

me‘) just how much shipping to the Netherlands entails? If you already know those shipping rates, it would save me the tremendous effort of having to mail someone to ask for them.Even though that would just barely be more effort than this thing I’m doing now.

Shipping to the Netherlands from Canada is just under $7. The same applies for most EuroZone countries, so for any Europeans interested in ordering, just choose the Canada option ($22) for your purchase. We’ll actually make a bit more money on European sales than on domestic (Canadian) sales, but we really didn’t want to price it too high, either. $25 is about the top end of retail pricing for a game this size (108 cards), and we’d like to be a bit competitive, as it’s our first self-published game and we need to sell a thousand copies!

Just bear in mind that delivery for overseas customers will be in the four to six week range. If you want it faster, we can ship it faster- but the price jumps exponentially. (And yes, before the maths geeks tell me it ain’t so, I know…)

I’ve checked a random number of countries (okay, it wasn’t TRULY random- FINE!) on all continents, and I’m pretty confident saying that we can ship pretty much anywhere on the planet cheaper than to our own country. So yeah- just choose the Canadian option and we’ll go with that!

This is so intriguing, considering 22CAD are just ~16€…

but my bank account is so empty atm and it is still nearly 2 weeks until august… must… control… urge… to… shop!

I’m told by people who seem to know, that boardgames are generally priced the same in Euros as they are in US Dollars (ie, a $25 game would be MSRP’d at 25€), so Sherwood Showdown should be a pretty good deal for those of you spending Euros or Pounds Sterling.

Yes, it is.

Not just board games. Video games, too.

50$ = 50€

Maybe a part of the higher price has to do with other taxes or the different dubs needed for European countries (though I still play everything in English).

But it still makes people unhappy.

Ok, people are cheapskates and want everything for ‘less’ (or free)… but still.

I heard this is really bad for the aussies. Higher prices for them make no sense whatsoever.

Hah! Thanks for the intel. I’ll be sure to initiate that four to six week wait as soon as I have some more spending money.

If I’m not writing SQL to embed in a program, I almost always say SELECT * FROM blah WHERE … very few tables I deal with have so many columns that the result is overwhelming.

Bad coder! *hits you on the nose with a rolled up newspaper*

Bad coder!

Asking for more than you need is one sure way to exhaust your DB server once the use of your application/website becomes popular.

I would’ve thought the “… not writing SQL

to embed in a program” part would’ve made it clear he’s talking about ad hoc SQL. Put your newspaper away.Yeah, but bad habits die hard. You start with ad hoc, and suddenly you’re doing it because you were tired at the time.

I very seldom program, but I can understand doing * for ad hoc queries. One of the primary reasons being that often I’m querying DBs authored by people who have column naming schemes that don’t stick in my mind very well.

And the two big reasons I have (besides database server kindness) for being specific with queries are that 1) if I request more than I want, then I have to write the logic to throw away what I don’t want, and 2) if someone alters the DB schema, I may be screwed. But throwing away visual data is easy, and knowing that the schema has been modified is sometimes actually useful.

As a professional who deals with MySQL every working day, I can honestly say I have never made this mistake…

I have a whole host of other mistakes that I make instead.

Did you know that it is actually requires more work in MySQL to delete a single row than it does to erase the entire contents of a table?

For one row it’s

Delete from table_name where ID = A_number

to erase the entire table contents it’s

delete from table_name

Let me assure you that this is a mistake you only make once.

Yes. And as my very wise instructor said “And once you’ve made that mistake you learn to always begin typing a delete statement as “delete where” and then CTRL-left to fill in the from table clause. Random accidental carriage return typos are a bitch.” (I paraphrase, of course. My memory isn’t that great.)

I’m happy to say that I have followed that sound advice religiously and never made that particular mistake. Flaws in the where clause are, of course, an entirely different story! :)

Hey, what’s with that giant yellow die with the numbers 0 and 7? Because I swear that looks six-sided.

We have never figured out what the deal is with the giant yellow 6-sider. My brother owned it at one point, and I’ve never gotten the story of where it came from or who would make such a thing.

What numbers are on the sides?

All prime numbers, perhaps?

No, I see 0 and 1.

Most passing strange. What are the other numbers on the die? This isn’t some sort of Holy Hand-Grenade (err…6-Sider) where 5 (and some other number) are RIGHT OUT, is it?

Numbers on the die, paired by opposites:

0 & 8

1 & 9

2 & 7

WTF?!?

I did a quick search, and all I could find about this nonstandard die was a couple of home-made maths games and this:

http://boardgamegeek.com/boardgame/25640/tumble-numble

It mentions such a die, but doesn’t look like the one in your picture.

I am more curious about the clear dice with dice inside them. They look funky. I dimly remember playing a game where the outer die controlled one thing, and the inner die controls something else.

As a Warhammer player I have to say that your collection lacks enough D6s.

With the right unit, under the right circumstances, you can be rolling about 40-60 dice, with Warhammer 40k being ~100.

I also think that in a blog post which is about giving something away for free, pretty much the whole space has been given over to random number generators…

That is, after all, why I keep coming back here :-)

As a 40K player i can attest to the 100 D6’s, i actually have a box of 200 D6’s in groups of 20 in different colours. Red, blue, green, yellow, black, white, gray, purple, orange and pink. And if Orks or ‘Nids are on the table then i’ve often needed most of those at once.

My son won a whole jar full of those clear-ish 6-sided dice with smaller die inside them. The outer plastic comes in assorted different colors. And, they sound kinda cool as you shake them.

He got them from some Math-Night event at his school, so I think they were just used for various math exercises.

It occurs to me that paired with a regular 6-sider it will make numerals up to 12. It wouldn’t surprise me if the original purpose wan’t to roll, but as a simulated clock or calendar function.

I own a calendar like that. 2d6. One is 0-1-2-3-4-5, the other 0-1-2-6-7-8. Provided that the numbers are printed in a font where a 6 can double as a 9, you can create all consecutive numbers from 0 to 32 with it.

There are staves for the month names, as well. If the sidelength of a d6 is 1 unit, the staves are 2 units long and have a quadratic cross-section with a sidelength of 1/3 unit. All of which means that the 2d6 can lie comfortably on top of the three staves, and that there are twelve stave sides available for the twelve months.

Pretty neat :)

The modulo operation gives non-uniform (read: unfair) results, unless the highest possible roll would have been evenly divisible by your selection — i.e. 250 instead of 282. A more fair solution would be to reroll if you rolled a number outside the selection range. To prevent too many rerolls you, could use a 4-sided die for the hundreds position, since you only needed to select 0, 1, or 2 (mapping 4 to 0).

I was wondering about that. Good to know I’m occasionally right (won’t make a habit of it).

I would have thought rerolling were the proper solution, too. But I think the module comes from programming. Usually, you have a standard random number generator that comes with whatever standard library your programming language of choice ships with.

Now, the random numbers generated usually cover the entire range of possible values of the returned data type, i.e. typically positive integer numbers. Now when you want to roll a d20 in C++ it would look like this:

int d20()

{

srand(time(0)); // required for technical reasons

return 1 + rand() % 19;

}

Here the % does modulo 19, cropping out the numbers 0..19 (from the potential 0..whatever), + 1 make the range 1..20. I suppose that’s why Shamus did the modulo. The problem is, given 3 common ten-sided dice, the range of numbers i 1..1000; now, 1000 divided by 282 is 154, which means that those comments in the latter 154 rows of the original data set have 1 “modulo cycle” less chance of occurring, which in our case means each of them roughly have a chance of 3 in 1000, while the rest have a chance of 4 in 1000.

It’s still sufficiently random given how it’s done manually and there has been a disclaimer anyway, but I’d just have re-rolled.

Probability can easily bite you because our brains are not so well-equipped to cope with the sometimes counter-intuitive results, heh.

> Here the % does modulo 19, cropping out the numbers 0..19 (from the potential 0..whatever),

That’s actually also wrong.

You have two possibilities as to what rand() returns. In some languages/libraries, it returns 0..MAX_RAND_NUMBER (inclusive or exclusive), but doesn’t guarantee that all bits are uniformly random. In fact, some implementations will always set one or more lowest bits to zero … and then you are left with a random generator that never generates 50% (or 75%, or 87%, or 93%, or 96% …) of all the numbers.

Others have rand() return a number between 0 and 1. Then you want multiplication, not modulo.

You can pretty much assume “rand()” refers to C’s standard library rand() unless otherwise qualified. Most other languages that spell it the same are (or were) exposing the implementation from the C standard library they were compiled with it anyway.

Re: good quality randoms: at this point, dropping in Mersenee Twister is easier (and far better quality) than ensuring you are getting good bits out of rand(). I’m not sure if the standard MT includes all these, but the one I have gives you either 32-bit integers or doubles in [0,1), [0,1] or (0, 1) with either 32 or 53 bits of precision.

I have to do this all the time (I make decisions with d20s like a “real” man.) you use the modulo and if you rolll outside the last “modulo cycle” you reroll. This gives an equal chance as with rerolling but reduces your chance of having to reroll.

This thread also taught me that modulo is what that is called. I love the phrase “modulo cycle” as well.

Also, thank god you finally through some random number generation in here Shamus. I was beginning to get bored.

That’s a good method, actually, I’ll have to remember that.

1000 (the number of possible results with three ten-sided dies) by 282 (the number of valid results) gives 3,5. (3, with a modulo of 154)

So, the first 154 people actually had a 0.4% (four results out of thousned) chance of winning, while the rest only had a 0.3% (three out of thousand) chance.

But, as Shamus said, the error was random :)

Before Shamus complains about people pointing out the flaws in his game: Hey, someone had to go and talk about computers and games (and pointing out flaws in them), and technology and geekiness for years, and now you’re wondering where all the gaming geeks with computer and maths knowledge come from who have to apply everything they know to everything they see …

Making this even more complicated:

I could have used one of two systems:

1) Roll result. If more than the number of entries, discard and roll again. Even distribution.

2) Roll result . If more than the number of entries, modulo the result. Uneven distribution.

However, I rolled within bounds on the first try. Both of the above systems yield the same result with the given roll. So the difference in probability comes from what I PLANNED to do, which wouldn’t have happened unless I’d rolled a different result.

Perhaps (though this seems unlikely comparing the example I have here) it’s part of a calendar. I have one that was once my grandfathers. It uses two numbered six-sided blocks, as well as six tiles with the names of the month(s) on either side.

Oh hell…I can’t believe I “replied” in the wrong section!

Obviously this was meant to be part of the “what is that big yellow die?” discussion…

Boy is my face (and now forehead) red…

As long as you’re already in the wrong section, I’ll go ahead and join you to agree with your diagnosis. With this 0-1-2-7-8-9 die, plus a 0-1-2-3-4-5 die, it’s possible to display any two-digit number from 01 to 31. (Actually 00 to 32, but whatever. And yes, it’s necessary to cheat and use the 9 as a 6 occasionally.) I believe I’ve seen calendars made in exactly this way.

I’m slightly disappointed by this result, in that I was hoping to have an opportunity to mention Sicherman dice here. But I’m going to go ahead and mention them without an opportunity. ;)

I would love to get a pair of such Sicherman Dice. Could really mess with our friends’ minds next time we play Settlers of Catan. :)

Are they difficult to find? (And no, I’d rather not just attempt to re-mark regular dice)

A Google search turns up a set by Gamestation that looks a bit low-quality (the stock photo has the “8” face badly off center), and another set by Grand Illusions that looks rather nicer. I’ll not attempt to include links so as to avoid triggering the spam filter.

I’m surprised these things aren’t sold more widely. The classic Sicherman dice are 122334-134568, but if you add one to all the numbers on the first die and subtract one from all the numbers on the second, you get the pair 233445-023457 that achieves the same effect. Dice with the 233445 numbering are commonly sold as “averaging dice”, so you’d think somebody would’ve made the 023457 to go along with them–but it doesn’t exist that I can find.

One of the most interesting things in probability is how much of it lies inside our own heads. On this particular roll it ‘didn’t make any difference’, but it only had a 28.2% chance of ‘not making a difference’, so it was actually very important (for a mathematician’s definition of very).

A (relatively) simple example of probability existing in one’s head is when we’re looking for statistically significant data. If we predict whether it’s going to be above or below the expected value before we make the observation, we’ve effectively doubled the confidence level (because if we didn’t make that prediction, there’d be twice as many possible observations that would be considered statistically significant).

Probability: a wonderful mindf***

That’s right :)

We were lucky that you accidentially still produced an even distribution … except … you didn’t, but at this point it becomes philosophical for the purpose at hand. Also, actually don’t care whether I had .3% or .4% chance of winning, it was just a spontaneous giveaway, and you might as well have said “first funny commentary wins”.

About the philosophical part, one nice interesting experiment on the topic:

In a game show, there are three cases, in one is a prize. The candidate gets to select one, then the host opens one of the other two (which is empty) and gives the candidate opportunity to change his choice. Should he reconsider? What are his chances of winning if he does?

Ah I remember this, and if i remember correctly, the solution was for the candidate to switch, because for some mathematical reason that would indeed increase his chances of winning.

Probability is one thing the human brain is so unfit for. That’s by the way also why no one understand quantum physics*.

*and to rephrase a famous physicist (can’t remember which one): Whoever claims to understand quantum physics, does not. Heh.

I remember reading about it. IIRC, if the candidate makes a switch there’s supposedly a 2/3 chance to be right (but only 1/3 if they don’t). The logic is something about the host intentionally not opening the correct one, but I don’t believe any of it. From what I understand it’s not even game theory, in which case I’d just roll over and play dead until the topic changes.

The way I see it, when the candidate first chooses, it’s 1/3 for any case. When one of the two others is shown to be wrong, it ups the chance to 1/2 for either, since the decision is between two not three. It only gets more complicated if I start wondering about the intentions of the host. Only reason to show one of the wrong ones would be to confuse the candidate and get them to change, in my eyes. Unless a double bluff or something would be going on.

Anyway, according to Wikipedia majority decide to go for “change” once the logic behind the “it’s a 2/3 chance” is explained.

I suggest you write yourself a little script in your language of choice to simulate the game.

Quick way of illustrating the logic:

Instead of three doors, suppose there are a *million* doors, but still only one has a prize.You pick door #1.

The host opens every door except #1 and #74,656. Those 999,998 doors he opens are all empty.

Where do you think the prize is?In both versions of the problem, the host has perfect knowledge of what’s behind every door. But when the host reveals 99.9998% of his knowledge, rather than just 1/3 of it, it becomes a lot easier to see the impact of the host’s knowledge on the problem.

This, basically. For any given amount of doors (say,

n), the player has a smaller chance to immediately pick the correct one (1/n), and a larger chance to pick a wrong one ((n-1)/n). After all the doors are opened except the chosen one and the right one / a random wrong one, the act of switching basically turns these probabilities around. If you picked the right one (smaller chance) and switch, you get a wrong one; if you picked a wrong one (larger chance) and switch, you get the right one.The ‘million doors’ example is an excellent way to illustrate that, but it really works for any number of doors.

For more fun: Each time the host opens a door and reveals that there is nothing behind it, the contents behind all of the other doors are redistributed randomly. Does that change the odds? Why?

Does it matter if the host has knowledge, if if he is just picking randomly, given that the 999,998 doors he picks randomly are all empty?

If we change the rule from “The host opens a number of empty doors.” to “The host picks a number of doors, all of which HAPPEN to be empty.” then the odds are even for all remaining doors. (“what are the odds of door 1 of 3, given that door 2 is empty?” as opposed to “what are the odds of door 3 of 3, given the odds that if door 1 is empty it must be door 3?”)

Even if the host just

happensto pick (n-2) doors that are empty, it doesn’t change the fact that the one door left unopened and unpicked is either the wrong door (at a 1/n chance) or the right door (at a (n-1)/n chance).Also: removing the host knowledge would open this hypothetical gameshow to the possibility of the host opening the right door by mistake. Just for fun, imagine this happening at door #999,998.

@Jarenth: I’m actually surprised by this result – but simulations bear out your point. Many arguments of the original problem statement are based on host knowledge, which this demonstrates are bunk. You don’t even need to know that *he* knew, just that n-2 other doors are wrong.

Reply to Jarenth just above:

No, the host’s knowledge is critical. If the host doesn’t know where the prize is, but just opens door(s) at random, then at every stage before the prize is revealed, every unopened door has an equal chance of containing the prize!

Consider the three-door problem with the ignorant host. You pick door #1. There’s a 1/3 chance this is right, and a 2/3 chance it’s wrong. Now the host, who has no idea where the prize is, opens door #2. If your original guess was correct, there’s zero chance of the host revealing the prize at this stage; if your original guess was wrong, there’s a 1/2 chance he reveals the prize. Assuming he does not, the chance that the prize is behind door #1 is now 1/2 (computed as (1/3)/(2/3) using conditional probability) and the chance that it’s behind door #3 is the same. So it doesn’t matter whether you switch or not.

In the million-door version, there’s a .000001 chance of your original guess being correct, a .999998 chance that the host accidentally reveals the prize at some stage, and a .000001 chance that neither of these occurs. Thus, should the host manage *not* to reveal the prize, your chance of winning by sticking with your original guess is now .000001/.000002 = .5, and your chance of winning by switching is the same.

To Simon: If your simulations bore out Jarenth’s point, then your simulations didn’t implement the “ignorant host” correctly.

@Kacky: Damn, you were right. I allowed the host to pick the same door as you:

Prints ~0.67. Fixing that gives ~0.5 as expected. It’s nice to know my intuition is better than my programming, I guess? Wait, that’s my job… :(

Ok, I’ve practically re-written this thing five times now, but after some monkeying around with statistics (Excel, mostly), I finally understand your logic and find myself able to reproduce your results.

It’s a little tricky because this is one of those examples where you have to go about your statistics while leaving the real-world complications behind: if you have (say) a five-door version of this game show without host knowledge, that would mean that on average, every three out of five contests would end with the prize door being opened (and I assume the show quickly cutting to commercial). But yes, stastically,

if this is allowed to happen, the chance of picking the right door instantly is identical to the chance of switching to the leftover door.It’s just that with

ndoors, the combined chance of either of these two things happening is a mere2/n. Which, in the million-door example, is going to lead to alotof disappointed contestants.This is exactly the explanation I know, too :)

If you pick one door, you have 1/3 of having tha right one, so 2/3 chance that the prize is in one of the other ones. By opening another empty one, the host tells you “if it’s one of the other two doors, then it’s going to be this one”. As stated above, you have a chance of 2/3 that the prize is behind one of the other two doors, thus changing your choice will double your chances.

Also funny how we went from boxes to doors … I think the original problem is with doors, but I didn’t remember that correctly :)

Yes, by switching, the contestant has a 2/3 chance of winning (NOT 1/2).

The answer is perfectly clear: When the contestant first chooses, they have a 2/3 chance of picking an empty case, with only a 1/3 chance of picking a prize case. The host ALWAYS opens an empty case (per rules of the game).

So, if you did indeed pick an empty case (again, 2/3 chance), and now with the other empty case just opened by the host, the only case remaining is the prize case. Thus, 2/3 chance of winning the game by switching.

Like the Wikipedia page, I don’t think you’re making any sense. I understand the 2/3 chance to be wrong, then one is removed, the remaining has 2/3 to be right -logic, but I think it’s inherently faulty. I appreciate all of you trying to get me to understand, but I don’t think that’s going to happen no matter how hard you try. Especially since I’m not feeling like thinking about this anymore.

All I’ll add is that I think the confusion arises because people attempt to calculate the odds at the switch-decision point, which is incorrect. You set the odds of winning at the beginning of the game before making any selection.

There’s also another one I ran into:

Alpha has two children, the older one is a boy.

Beta has two children, one of them is a boy.

How likely is it for each parent that both of them are boys?

Or “How can it be that Beta is less likely to have two boys?”

But you need to take care to stipulate that you mean “Beta has at least one boy” rather than “Beta has exactly one boy” or else you’ll just wind up confusing Shamus’s readers. :)

A sizable fraction of the difficulty with probability is really just difficulty with stating the problem carefully. The host always opens a door that he *knows* to be empty; Beta may have any sequence of children other than two girls. Once you make that key fact clear, much of the confusion vanishes. Not all of it, mind you, but most of it….

Assuming that ‘Beta has at least one boy’ is even what’s meant: this could also be a word puzzle instead of a probability one.

It works as a probability riddle too, though, in which case your ‘key fact’ does wonders to explain the catch.

“One is a boy” may be deliberately vague wording for purposes of making the “puzzle” appear more puzzling, yes.

Also, it’s difficult to imagine a real-world situation where you’d know that “Beta has two children and at least one is a boy” in this sense, without also knowing other information that’d change the answer.

In practice, if you know that the children aren’t both girls, then you’re probably not in a situation where the remaining three outcomes {BG, BB, GB} are equally likely. Presumably this is part of the reason why “natural” wording leads us astray on this problem.Consider: You’re walking down the sidewalk, and you pass a total stranger with a five-year-old son in tow. Being a slightly nutty math nerd, you stop this stranger and inquire as to the total number of children in the family. If the answer is “two”, what’s the probability that the other child is a boy?

Here the answer

is1/2, exactly as we’d expect, because there arefourequally likely outcomes:* The child you see has a younger brother.

* The child you see has a younger sister.

* The child you see has an older brother.

* The child you see has an older sister.

If you

reallywant to tie your brain in a knot, try to think of a quasi-realistic situation in which you could end up having exactly the right information about Beta for the 1/3 probability to be correct. At the moment, I can’t see how it’d ever happen, absent a trickster mathematician handing you just that information and no more.Obligatory xkcd link

Ask each “Are you the guy who stabs people?”. If two answer yes, the one who said no is the one who always tells the truth. Ask him which is they way out and take it. If one answers yes, he is the one who always lies, ask him if each path is the way out and take the one he says it isn’t. Of course, the rollover text kind of makes the point moot :)

Quasi-realistic situation: the stranger smirks, and tells you “I have one more kid next to this one —

and that kid is not this one’s younger brother“.1/3 probability of the other kid being a boy. You’re welcome, it’s what I do.

So, 1/3 younger sister, 2/3 older sibling (1/2 for either boy or girl). Which would make 1/3 for older brother.

Not that I support the “1/3” claim. It could very well be that the stranger is taking care of that kid for someone else. But I suspect I’m missing something.

I think the 1/3 probability comes from how it would appear on statistics. If you have a group of people with two children and assign them on the teams Alpha (older one has to be a boy) and Beta (either is a boy), you’ll end up having everyone on Alpha appear also on Beta. But you’ll also have the “younger child is boy, the older is a girl” -parents there as well. So it’s 2/4 parents on Alpha and 3/4 parents on Beta. Only 1/4 is “both are boys” -families, so that’s 1/2 in group Alpha and 1/3 in group Beta. I’m willing to bet that the claimed statistical support is based on this kind of data, if it actually exists.

But if you take 100 parents with two kids and at least the older one is a boy, but otherwise chosen randomly, and 100 parents with two kids and at least one of them is a boy, but again chose randomly, you’d end up 1/2 and 1/2. Which is how I would do it, since it was a set amount of people in the beginning too.

Couldn’t the dice collection be an “extensive start”?

You could try as a mnemonic that “don’t put two statements right next to each other”. I know it draws my attention when I see two words in a row highlighted the same.

Then you can go “wait, why was I not supposed to have these next to each other?” then spend half an hour thinking, before finally making the same mistake all over again.

So yeah. Forget I said anything.

Doing modulo 282 doesn’t give you an even distribution…

ah, well no one said it was going to be fair :-P

While I didn’t win, I do appriciate the added +1 button as I’m slowly switching over to google+

> If I get a number greater than 282, I’ll modulo the result with 282.

Thereby biasing the result towards 1 .. (1000 modulo 282), i.e. anyone with post number greater than 1000-3*282 (-154) had slightly lower chance to win than anyone with post number less(er?) than that.

(also, giving a “chance” to win to number 0).

Not entirly unfair, given that you didn’t say/write the chances would be equal for everyone, but it looks like something you just might not have even considered.

(ninja’d twice, but whatever)

Actually, the chances WERE exactly the same for everybody.

Suppose Shamus rolled the dice beforehand, but determined the winner in exactly the same way. Then the rule would have been “whoever enters 236th wins”.

Since nobody knows the rule, even if they knew it was “whoever enters nth wins”, then they all must have equal chance. I figured that there was a nonzero chance of involving a modulo, and that, if present, it was more likely to favor the early entrants than the late entrants, so I choose to enter early to game what I though the system might be. I think I got my bonus 1/1000 chance. (in fact, the odds favor it.) Shamus could easily have reversed the order, giving the higher chance to the later entries, or ordered them ASCIIbetiaclly, or some other manner so as to randomize who had the higher chances (using the submissions themselves as the seed for that randomization).

Also, I don’t know what order the entries appeared in when they came out of mySQL. They might have been in chronological, or reverse-chronological order, or in the order they would appear on a threaded page, or something like that. In which case, the first ~150 entries had a higher than average chance of winning, but everyone had an even chance of being in the first 150.

:)

Depends on the indexing. There’s probably an index on comment number, so the entries probably came out in ascending order.

“Whoever enters random(N)th wins” is only fair if there are exactly N entrants. “Whoever enters Kth wins” for *any* private K (random or not, only needs to not be predictable) is fair if and only if there are at least K entrants (obviously). “Whoever enters Kth wins” for a *public* K is biased to the person with the best reflexes and internet connection :).

Do the previous comments take into consideration the weight of the dice? Since they impact the odds too!

Shamus just said it’d be random, not PERFECTLY random.

I’d argue that the modulo would effect more than the weight of the dice. On the other hand, how you throw them should affect more than the weight.

How about that wooden table surface?

Surelythat’s influenced the rolls somewhat!Clearly, the weight of the dice impacted the table surface, and the table surface impacted the dice in an exactly equal and opposite amount. So the net effect on the roll was zero.

Now that we have proven that there was no net effect, we can disregard the rumors that Shamus used a net to effect the roll.

Also, my attempt to enter under 280 different email address’s didn’t work. Why must there always be just one person, who can rise up and derail my plans… I knew there was a problem when I turned into a snake.

Obviously you rolled the ones as a 1-10 die and the tens and hundreds as 0-9 dice?

>.>

<.<

(I didn't enter)

All three would be counted as 0-9. A result of 0-0-0 means he rolled 1000.

Or zero-index the array.

I think you would enjoy LINQ’s method.

var result =

from s in source

where s.thing = ‘something’ && s.other = ‘otherthing’

select s;

You start with the general (a table, an in memory collection, whatever) and then filter it (where) and finally say what you want (the select s could return only part of the object queried).

The result is a collection you can ‘foreach’ over easily, but my favorite thing about LINQ is that the IDE doesn’t have to guess what properties ‘s’ has, so you get type safety and autocomplete.

At first it grated on me (I’m a long time SQL addict I have complex SQL queries etched into my brain), but now SQL annoys me that it doesn’t work this way.

You have to be careful to not build n+1 queries, though.

Could you explain?

(S)he means this problem.

That’s the one. The main problem’s that ORMs have a tendency to do n+1 queries if you aren’t careful with doing stuff like:

foreach (Car car in (from car in db.Cars where car.type == CarType.RaceCar select car)) {

// This will do SELECT * FROM Cars WHERE type = 'R' or similar.

foreach(Wheel wheel in car.wheels) {

// And then this will do SELECT * FROM Wheel WHERE CarId = id once for each Car.

wheel.turnLeft(90);

}

car.accelerate(10);

}

(The right way in this case’d be to select all the wheels, join to the corresponding cars and maybe group by car)

I wasn’t even in with ANY chance because there was no chance of a post below 111 being picked. “sigh”

NM, wrong meaning of the word “below”. Carry on

Each die was a digit. A 0 in this case means “zero” not “ten”.

I’m pretty sure SQL is the way it is ’cause it was based on idiomatic english.

“Select X From Y” makes sense. “Select From Y X” doesn’t. I can’t figure out how you wouldn’t get confused with the latter.

Plus, the in-between words offer clear visual separation between table name Y and column names X. Less need to parse stuff. Y’know, the “write once, read many” thing. ;)

How unfair I didn’t win… oh wait i didn’t post huh?

YAY! =P

So who won?

“Winner Announced”

Just not here… You have a cruel sense of humour.

“My wife gives directions like this, and it always leads to those sort of unintentional misunderstandings that keep sitcoms in business after all of these years.”

Random factoid: the way people give directions, either general->specific or specific->general was used by Carl Jung as a big differentiator in the Intuitive/Sensate personality spectrum. It sounds like you tend to think in intuitive ways – big leaps, looking at the big picture; while your wife likes to think in details first.

I wrote ‘Gimmie’, paused for a second and thought to myself “I’m sure it’ll be fine. Capitalization won’t matter”. Next time Shamus runs a contest I will be sure to follow directions precisely.

The REGEX command in MySQL is normally case insensitive, so any capitalization should have been fine.

You forgot to send me the e-mail to get my information. I mean

obviouslyI won, but there’s nothing in my inbox from you.So, yeah, just send that along when you get a chance. kthx!