Different Types of Intelligence

Two nights ago, my friend and I were playing cribbage and she was dealt four threes. Although in cribbage, a four of a kind is only worth 12 points, it looks impressive and neither of us could remember ever having seen one before. "I wonder what the odds of that happening are?," I asked. We thought about it a bit, but let it go, and soon after the game was over and we fell asleep.

Yesterday afternoon, we were sitting at a neighborhood bar enjoying a sunny weekend afternoon when the subject came up again. We asked the waitress for a pen and began scribbling lots of numbers over our napkins. Finding the odds of a four of a kind out of four cards was easy, but how did we handle the extra two that you get in cribbage? Should we subtract? Add? Divide?

We ran out of beer before we came up with the answer. After returning home, she started searching the internet for it. I decided to just figure it out by blunt force. Within a few minutes, I had put together a script that would deal 500,000 random six card hands and keep track of how many of them included four of a kind. I opened up my browser and started running the script. My computer's fan revved up loudly and I feared that I was about to kill my computer, but it didn't die and, in a matter of minutes, I had my answer…

976. I waited a few minutes to let my computer cool down and then ran the script again. 976 again. "Well, you have to run it a third time then." And so I did. Guess what? 976. So, after dealing 1.5 million hands, I have a fairly accurate guess that the odds are 0.001952 out of 1, or 0.1952%. But that's just a hypothesis, not a proven answer. What frustrates me is that I know there is a way to figure out the "real" answer, but I'm not smart enough to figure it out.

She found the following equation on Wikipedia that shows how to get the odds of four of a kind out of five cards:

Four of a Kind Odds

I know we just have to change the 5 that is over the 52 to a 6 to get our answer, but I don't know how to calculate that out after doing that. Even if I did, that wouldn't be me coming up with the answer. Someone else wrote that equation, we just found it.

That got me thinking (yes, I had had a few beers and was being annoyingly philosophical) how it seems that there are different types of intelligence that can get nearly the same end results:

  1. Abstract Logic: There are people out there who could whip out the equation we're looking for out in a matter of seconds and have a proven answer to the question. I'm not one of those people and it often frustrates me that I'm not.
  2. "Seeker" Logic: This is becoming more and more prevalent with the rise of the internet. Instead of coming up with our own answers, we just Google the question. It works well for questions that others have already thought of, but can fall short if the answer hasn't yet been posted.
  3. "Doer" Logic: People like me who might not be smart enough to go head to head with the problem, but who can devise ways of getting around it. Although, in the end, they might not have the official "right" answer, they can often get pretty damn close to it.

Any opinions on this? Are people's types of thinking that easily separated? I'm sure there is a lot of overlap, but I think that people tend to gravitate towards one of these methods more often than not. What type of thinker are you?

Finally, in case you're curious, here's the code I wrote to deal the hands and check for four of a kinds:



$fourofakind_qty = 0;
$hands_qty = 0;

for ($i=0; $i<500000; $i++) {
	$hand = array();
	for ($j=0; $j<=6; $j++) {
		$hand[] = pickCard($hand);
	$values = array();
	foreach ($hand as $card) {
		echo $card.' ';
		$value = getValue($card);
		$values[$value] = @$values[$value] + 1;
	foreach ($values as $value => $qty) {
		if ($qty == 4) { $fourofakind = true; $fourofakind_qty++; }
		else { $fourofakind = false; }
	echo '<br />';

echo '<br />';
echo 'hands: '.number_format($hands_qty).'<br />';
echo 'four-of-a-kinds: '.number_format($fourofakind_qty).'<br />';
echo 'percentage: '.round(($fourofakind_qty / $hands_qty * 100), 5).'%<br />';

function getValue($card) {
	$num = substr($card, 1, 1) ;
	if ($num == 'a') { $val = 14;}
	elseif ($num == 'k') { $val = 13;}
	elseif ($num == 'q') { $val = 12;}
	elseif ($num == 'j') { $val = 11;}
	elseif ($num == 't') { $val = 10;}
	else { $val = $num; }
	return $val;

function pickCard($used=array()) {
	if (!is_array($used)) { $used = array(); }
	$rc = remainingCards($used);
	return $rc[0];

function remainingCards($used=array()) {
	if (!is_array($used)) { $used = array(); }
	$cards = array('sa','sk','sq','sj','st','s9','s8','s7','s6','s5','s4','s3','s2','ha','hk','hq','hj','ht','h9','h8','h7','h6','h5','h4','h3','h2','ca','ck','cq','cj','ct','c9','c8','c7','c6','c5','c4','c3','c2','da','dk','dq','dj','dt','d9','d8','d7','d6','d5','d4','d3','d2');
	foreach ($cards as $key => $card) {
		if (in_array($card,$used)) { unset($cards[$key]); }
	return $cards;




This post was published on May 30th, 2011 by Robert James Reese in PHP. Before using any of the code or other content in this post, you must read and agree to our terms of use.