Tuesday, November 14, 2006

Creative Representation of Problems

I had originally thought about speaking about a topic more close to home and more about Codeworx Design Studio as a business, but for a variety of reasons, I’m going to instead talk about a different topic with regards to programming in general.

Just this past week alone I found myself preaching a couple times about the importance of being able to represent problems. This was one of the earliest things I was taught by one of my favorite college professors (Professor. Robert Lamphere). Mr. Lamphere was big on representation and while talking with him about various problems & solutions, it actually opened my eyes to other ways of looking at things beyond how I was already representing problems. In my opinion, great programmers possess the skill of representation; I believe this goes to the fundamental skill of creative problem solving. And so as I talk to developers early in their career, I always try to talk about creative representation of problems.

An example that I like to use and which I will talk about here is what I call the “Cracker Barrel Puzzle”. For those who don’t live around Elizabethtown, KY, hopefully you have heard of a restaurant called Cracker Barrel. One of the things that I always liked about Cracker Barrel was that they had these puzzles on each of their tables which consisted of a triangle with 15 holes. In 14 of the holes were golf tees, and the object of the puzzle was simple, try to leave as few golf tees as possible by “jumping” other golf tees. And the term “jumping” follows the rules of jumping in checkers, in order to “jump” another tee, the destination hole had to be free.



One day I was curious how many combinations there were to this puzzle, so I decided to write a program designed to solve the puzzle. After some thought, I determined that instead of trying to represent the program as a shape, perhaps using some kind of array or structure that could “visually” represent the puzzle. The puzzle could be represented as a single string of 15 hex characters and that every move possible could be represented by only 36 rules (each rule defined as 3 hex characters: starting, jumped, destination). By representing the program in this manner, I was able to create a fairly straightforward program that tested various conditions for these 36 rules and ultimately find the combinations that resulted in only 1 golf tee being left on the board.



Ultimately, I ended up finding thousands of solutions and at one point I dumped them all into a database and tried to determine which starting point on the puzzle board produced the most results. With the information I had gathered, what I designated as hole 13, seemed to have the most solutions possible.

But again, the point here is that by representing a problem in a different manner, you are most of the time able to take something that while at first may seem hard and break it down into easier steps. So remember this next you have a creative problem to solve. Try to get inspiration from things around you. I try to model what I can off of nature (bee flight, leaf patterns, rain drops, etc) as it seems that in the world of nature, there is a system which apparently works, but then again, don’t rule out things more mechanical and man made, I remember Mr. Lamphere once talking about using gears as a method of representation where one part of the representation was a small gear and the other part a large gear and the intersection or point at which the teeth of the gears met could potentially be a solution?

~ Bobby

1 comment:

  1. Bobby

    Can you send me the solution to the cracker barrel puzzle?

    Wildcat

    ReplyDelete