共用方式為


Campy Bear Heuristics

Here's a puzzle for you: I am out camping. One day I mark my spot and then walk one mile due south, at which point I turn ninety degrees to my left and walk one mile due east. I pause to admire the scenery, am startled by a bear, and run one mile due north. At this point I am back to my starting place, seem to have lost the bear, and have lunch.

Where am I camping? What color was the bear?

One answer is "obvious". There are many other correct answers as well. How many can you find? Answers below.

I ask this question because I recently I read two books. Both are titled How To Solve It. Both are encyclopedias of heuristics for solving problems. Both are chock full of examples which demonstrate how to apply the plethoras of heuristics they contain to specific hurdles you may or may not find yourself facing in your daily life. Neither is what I consider light reading. Both made my brain hurt. Both have ideas you can apply to your testing. (Even if you aren't inclined to wade through the math!)

The first How To Solve It was written by George Polya decades ago. The first few pages present his oh-so-simple problem-solving algorithm:

  1. Understand the problem.
  2. Devise a plan.
  3. Carry out the plan.
  4. Look back and validate your answer.

The remaining pages use a series of math problems to explain how to apply this procedure. Regardless of whether you work through the problems or skip them, be sure you understand why George takes the approaches he takes, and consider how to apply them to your testing.

The second How To Solve It was written by Zbigniew Michalewicz and David B. Fogel a few years ago. Their version is effectively a sequel to Polya, presenting and explaining a variety of often-used-today algorithms and heuristics. They note that, despite the massive computing power we now have at our disposal, solving real-world problems is as difficult today as it was when Polya wrote his tome. Solution spaces are still often too large to exhaustively search, and the person solving the problem may still be inadequately prepared to do so.

I won't attempt to summarize the many problem-solving algorithms Zbigniew and David present. I do however want to highlight two points they stress:

  • Most problems have more than one solution. Furthermore, the first solution you find isn't necessarily the best answer.
  • Thinking about your problem is important; actually working on the problem is important too. The best testers I know often seem to spend more time pondering how to test their product than they do actually testing it. Once they start testing, however, they find flurries of important issues fast. As they do so they use the information they learn to change their approach and triangulate in on a more effective process. (One reason I like Session Based Test Management is that it institutionalizes this think-do-think-do cycle.)

If you find math fun, these books are stuffed to bursting with interesting problems for your puzzle-solving pleasure. If balancing your checkbook is math enough for you, you can skip the gory details and still learn bunches. If you'd rather bypass even the task of searching out pearls of wisdom from masses of math, both George and Z+D summarize the important bits (George first thing, Z+D last thing).

So, d'ya have a solution to my riddle yet? The canonical answer is that I must be camping at the North Pole, because that is the only location where walking one mile south, one mile east, and one mile north would return me to my starting point. Thus the bear must have been a polar bear, thus it must have been white.

This is not however the only solution. I could be camping one mile north of a parallel on the Southern Hemisphere which happens to have a circumference of exactly one mile. So I could walk one mile south, walk one mile east (completely around the globe), and follow my footsteps one mile north back to my campsite.

I could also be camping one mile north of a parallel on the Southern Hemisphere which happens to have a circumference of exactly one-half mile. So I could walk one mile south, walk one mile east (circumnavigating the Earth twice), and follow my footsteps one mile north back to my campsite.

Do you see how there are an infinite number of possible locations for my tent?

The bear could be any color imaginable as well - as there aren't any bears in Antarctica, I must have hallucinated it!

*** Want a fun job on a great team? I need a tester! Interested? Let's talk: Michael dot J dot Hunter at microsoft dot com. Great testing and coding skills required.

Comments

  • Anonymous
    January 30, 2008
    Loved this one as well. I'm afraid I read too far in and you revealed some of the answers, so I feel kinda ruined on this one. I was going to be pedantic and answer: Q: Where are you camping? A: Outside, not 'In' ( "I am out camping" ) A: On land ( "I walk..., I run..." ) A: On Earth ( I, walking, running, bears, etc. ) Q: What color is the bear? A: Not the exact same color as the scenery ( "...I pause to admire the scenery, am startled by a bear")

  • Anonymous
    January 30, 2008
    Hi there! Interesting riddle indeed! My thoughts were: You could have been camping in some snowy place and marked your spot with something, like a stick or so in the ice. You walked 1 mile south then 1 mile east and then after being scared by a polar bear, 1 mile north again! There is no mention of how long the walking took! It could have been that the snow/ice moved pretty much by 1 mile towards the east to give you the illusion that you back at the same spot! What do you think? Great blogs, keep it up, i enjoy it.

  • Anonymous
    January 30, 2008
    The comment has been removed

  • Anonymous
    January 31, 2008
    Zach, m_i_m, Jim: I like the way you think! Thanks for proving my thesis that multiple correct answers always exist!

  • Anonymous
    January 31, 2008
    The comment has been removed

  • Anonymous
    February 06, 2008
    I wonder if any developers were reading this and thinking "why were you walking a mile south!? everyone knows there are bears there!" Another cracking blog, they're always guaranteed to get me thinking.