Saturday, February 26, 2011

Cribbage

Cribbage is a fun card game. In it, you're dealt six cards, and you have to discard two. Afterwards, a starter card is drawn. The four cards you're left with and the starter card determine how many points your hand has. (There's of course more to the game than just that, but that's what's relevant.)

The scoring works like this:
His nobs - If you have a jack of the same suit as the starter card, that's 1 point. (If that starter card is a jack, that's something different and gets counted at a different time.)
Flush - If your hand has all cards the same suit, that's 4 points. If the starter card is the same suit too, that's another 1. After this, there's no difference between the starter card and the ones in your hand.
Pairs - For each pair you have, you get two points. Note that cards can be counted multiple times, so if you have a 4H, 4D, 4S, that's three pairs (4H, 4D), (4H, 4S) and (4D, 4S) for 6 points.
Straights - If you have three or more cards in a row (like 3, 4, 5) you get as many points as the straight is long. Personally, this seems somewhat inconsistent, since a straight of four is also two straights of three, which would get you 6 points instead of 4.
Fifteens - For each sum of fifteen you can make, you get 2 points. All face cards count as ten. Cards can again be counted multiple times, so if you have two tens, and two fives, that's four fifteens for 8 points.

Anyway, I was curious as to what the average hand value would be if you always discarded so as to give your hand as many points as possible (which you don't actually always want to do, because of other parts of the game, but oh well). So I made a program which goes through all 20,358,520 possible hands of six you can be dealt, and finds the best two to discard, taking into account the different possible starters cards.

All told, it ended up running for about 18 days. But it did finish. And here are the results.

The average hand value is 8.29 points.

The most frequently discarded rank is king at 11.56% of all discards.
After that is queen at 9.85%
8 at 9.30%
7 at 8.85%
Ace at 8.78%
9 at 8.37%
2 at 8.27%
10 at 8.02%
3 at 6.72%
6 at 6.55%
Jack at 6.14%
4 at 5.39%
5 at 2.17%

Wednesday, February 2, 2011

The Ship of Theseus a.k.a. Grandfather's Axe

There's an old philosophical puzzle. Suppose you have a wooden boat. You notice some of the planks are getting rotten, so you replace them. Is it still the same boat? As time goes on, you replace the planks one by one, until every single plank making the boat has been replaced. Is it still the same boat?

Alternatively, your grandfather's axe is a family heirloom. But when your father got it, he replaced the head, and when you got it, you replaced the handle. Is it still the same axe?

I posit that identity cannot be determined by the identities of the constituent parts.

First, I'll assume that identity is something that can be discerned - that is it's something that can be determined by observation. Intuitively, this makes sense. If you see two boats, you can distinguish them by how they look, even if they switch positions, or change by small amounts. Even if you have two boats made the same, there will be minute differences that can distinguish them. And the same with the planks. You can tell two planks apart.

But the fundamental constituents of matter have no such identity. An electron is an electron is an electron. All electrons are indistinguishable, and provably so. If you had an electron, and you put it in a box full of other electrons, it would not be possible to find your initial electron again. In fact, there isn't such a thing. Initially, there was one electron in your hand, and many electrons in your box. Then there were many+1 electrons in your box. The one electron cannot be uniquely tracked. It has no identity.

What this means is that if you have, say, a hydrogen atom, and then instantaneously swap out the electron with a different one... Then nothing has changed. Nothing has been done. If that hydrogen atom had an identity, it could not have changed, even if every single subatomic particle in it had been swapped at the same time.

On the macroscopic scale, things can have identity, because they aren't indistinguishable. They have different particles in different configurations following different patterns.

Identity is one of those things that makes sense in our experience, but which breaks down in extreme thought experiments because it has no fundamental truth to it and our flawed conceptions were only meant to work with what we have experience with.