Live data from Hacker News

The Kruskal Count Card Trick

faculty.uml.edu

11–20 of 43 posts

Re: The Kruskal Count Card Trick

#11

Since all face cards count as a 5, does the probability increase or decrease if you remove all face cards?

I put together a small simulation and I think you have an 82% chance of winning with the setup described (though I welcome repeats). Replacing the J/Q/K with a score of 10 and the win rate drops to ~68%.

Intuitively anything that makes you take shorter steps should increase the chance of merging with another path.

Re: The Kruskal Count Card Trick

#14
post #13
post #12

Sounds suspiciously similar to rainbow tables used for hash reversals... or am I off here?

If there's a connection I certainly don't see it.

There is a strong connection with rainbow tables. A common misconception is that rainbow tables are a complete set of hash values. What they actually are a method of saving storage space at the cost of making searches slower.

The idea is to make a function that maps hash values back to password-like strings. With that function chains like this are built:

    I=initial password guess
    P=new password-like string
    V=hash value
    H()=hash function
    U()=unhash function (converts V to a new P)

    I -> V0=H(I0) -> P0=U(V0) -> V1=H(P0) -> P1=U(V1) -> ... -> Vfinal
Make many chains with different initial guesses, and store the first and last values [I, Vfinal] in a database. When you find a password hash, you repeat the H(U(H(U(...)))) process until you it matches one of your saved Vfinal values. This tells us the hash value path from the password hash we're trying to break and hash from the known initial guess merged, just like in this card trick.

Re-creating the chain from the chain of hashes from our known initial value, we discover a string that might not be the actual password, but is a string that hashes to the same value. With modern cryptographic hashes, collisions are unlikely, but rainbow tables were invented when passwords used very poor hashes.

Re: The Kruskal Count Card Trick

#15
post #11

Since all face cards count as a 5, does the probability increase or decrease if you remove all face cards?

I put together a small simulation and I think you have an 82% chance of winning with the setup described (though I welcome repeats). Replacing the J/Q/K with a score of 10 and the win rate drops to ~68%. Intuitively anything that makes you take shorter steps should increase the chance of merging with another path.

I wonder then why not make face cards a 2 or something. Perhaps that would make it more obvious what is going on?

Re: The Kruskal Count Card Trick

#17
post #2

this is super interesting! The deeper explanation[0] really gets to the essence of what's happening here. An interesting corrolary: the deeper down the deck you go, the less number of paths are actually available. For example, if you have 10 cards on the first row, then there are at most 10 paths to the end, but those can merge. So if you have many cards, paths will merge and you might just end up with one path. So m…

> For example, if you have 10 cards on the first row, then there are at most 10 paths to the end, but those can merge In fact they must converge, suppose that the first card on the first row is less than 10, then it will merge with another path on the first move (because it will land on the first row), so it must be 10 to have no merging paths. The next card will merge with another path on the first row if it's less…

> In fact they must converge

Are you sure? Is this board not a counter-example if A starts on the right-most column and B starts on the second from the right:

  x x x x x x x 8 9
  x x x x x x 8 x 9
  x x x x x 8 x x 9
  x x x x 7 x x x 9
  x x 7 x x x x x A
  B x x x x x x

Re: The Kruskal Count Card Trick

#18
post #7

Earlier quoted context omitted.

> For example, if you have 10 cards on the first row, then there are at most 10 paths to the end, but those can merge In fact they must converge, suppose that the first card on the first row is less than 10, then it will merge with another path on the first move (because it will land on the first row), so it must be 10 to have no merging paths. The next card will merge with another path on the first row if it's less…

the fact that they must merge is really dependent on the distribution of cards within the deck, though. For example, imagine if your deck was filled with 9s. You would get 2 paths merging but not much else. Of course with the standard 52-pack you'll end up with a high degree of merging. I just think it's important to say that the necessity of merging is really dependent on the instruction set, so to speak.

I think the fact the deck doesn't have many repeats of 9s. It has lots of repeats of 5s which causes merges and the other numbers will eventually merge. You have 4 each of 6,7,8,9. If you repeat 9 4 times there will be no more 9's and it will merge.

Re: The Kruskal Count Card Trick

#20

Earlier quoted context omitted.

> For example, if you have 10 cards on the first row, then there are at most 10 paths to the end, but those can merge In fact they must converge, suppose that the first card on the first row is less than 10, then it will merge with another path on the first move (because it will land on the first row), so it must be 10 to have no merging paths. The next card will merge with another path on the first row if it's less…

> In fact they must converge Are you sure? Is this board not a counter-example if A starts on the right-most column and B starts on the second from the right: x x x x x x x 8 9 x x x x x x 8 x 9 x x x x x 8 x x 9 x x x x 7 x x x 9 x x 7 x x x x x A B x x x x x x

TFA says the two-deck version is successful about 95% of the time. If you click through, it says the one-deck version works 80% of the time.
Post reply on HN