Sometime in 1982-83, I was working on a programming problem using a Z-80 computer. At the time, the board was considered an industrial or laboratory computer and was, in many ways, relatively advanced. The board featured a version of BASIC with the ability to call your own assembly language routines within the program. It also featured some relays, switch inputs, a video interface, and even an EPROM programmer.
While writing a control program, I found myself stuck. At some point, and not always the same point, the program would crash. My attempts at isolating the problem, however, were unsuccessful after a day of struggling. It seemed as though each piece of code that I isolated worked as I intended, but together, the program crashed.
The following day, I was back to debugging and one colleague asked if I cared to walk into town for some lunch and a few games of darts. Frustrated, I barked “Why the freak not?” (I didn’t say “freak”)—and off we went.
After a nice cheap meal, it was off to darts. After several games and some socializing, we walked back to the lab. During the entire excursion, we did not mention anything to do with the problem I was working on, or that was working on me.
A few steps from the doors to our destination, I stopped and exclaimed loudly, “I’m smashing the stack!” While my friend may have been contemplating what kind of pharmaceutical therapy might best benefit me, I felt a burst of both pleasure and excitement. I knew I had the solution.
I sat down and within a few minutes fixed the problem. You see, on the Z-80, the stack is usually set to high memory (and there was not all that much memory) and it grows down. On this board, the BASIC interpreter and the EPROM were in low memory. The user’s BASIC program and any assembly language routines start after those and build up. When the building up collides with the building down, you have program annihilation.
The solution found me and it felt great.
About a year ago, I was working on programming a PIC12F1572 to create a one-chip color fader. Using PWM, an RGB LED slowly changes color and it is a very pretty effect. I hit a roadblock with the code going haywire at some point. I spent many hours trying to find the bug. Using breakpoints to isolate code sections as best that I could, I struggled into the wee hours. Finally, and after going through the code listing line by line without success, I gave up.
I proceeded to some mindless situation comedies on cable for a while and then went to sleep. The next morning, I was drinking coffee in my easy chair and there beside me was the printed code listing from the night before. I picked it up and began casually browsing when it instantly and effortlessly came to me—I had neglected to do a bank select at a critical point!
This chip has banked memory partitioning. Basically, there are 32 banks of “special” memory that all have the same address and they are switched for program access by writing a value to the Bank Select Register (BSR). So, if you want to access a PWM register, for example, and it is in bank 27, you need to make sure that the BSR contains 27. If it does not, you will still access a value, but it will not be the value that you intended to read from or write to. It will, instead, be whatever value is in the register at that address of the bank that the BSR references.
That’s what was happening and it had completely escaped me for a very long time. Then, suddenly and without any particular effort, I was able to instantly and unequivocally see the solution, and the feeling was intensely pleasant.
The one-chip color fader
What these two events (and many more in between) have in common is that they are examples of the “Aha! moment”, sometimes called the “Eureka effect”. It describes an intense moment of insight following a period of being “stuck” on a problem.
In general, it has several particular characteristics:
- It occurs suddenly.
- It seems to occur without effort.
- It feels very good.
- You just know that you have the solution.
We have all experienced Aha moments. While particularly notable in science and engineering, they can occur with any problem in any field or aspect of life.
Scientists will study anything and that includes the “Aha moment.” Of course, they can’t very well have you live in a lab until you get stuck on a problem and then wait and hope for an Aha moment to occur (that’s called graduate school).
Instead, they can study the process of insight by having subjects solve certain kinds of problems in the laboratory. Many such “compact” insight problems exist (see here for examples) and they are evolving (PDF).
Below is a very common problem that you may recognize (see the end of the article for the solution).
Connect all the dots using just four straight lines.
Some of the most compelling results from these studies use imaging techniques like fMRI. That is, they are designed to reveal which brain areas are most active during the insight moment by taking a “picture” of brain activity (see an example here).
A Possible Explanation
I suspect (with more opinion than data) that the onset of the insight involves some level of disinhibition. Many complex cognitive tasks involve the simultaneous processing of a number of mental constructs. For example, if you are writing some code or designing a circuit, you probably find yourself juggling a number (7+/-2? See here and here) of mental constructs simultaneously.
You have to keep all of these mental constructs present and balanced as you plow forward. This may be one reason why we can be notoriously unforgiving of interruptions when deeply involved in the creative process. One interruption and all of the constructs come tumbling down.
In my view, when we get stuck, it is often because we have erroneously assumed some characteristic of one or more of the constructs. Once accepted and incorporated into the scheme of our creative process, the constructs become resistant to evaluation. That is, you have an inhibition to reevaluate the constructs objectively. To the extent that this is true, removing the inhibition may be a way of facilitating the Aha! moment—and that is what we are really after.
Can We Prime the Pump?
In so many instances of the Aha moment that I have experienced when I have been truly stuck, the insight was preceded by some period of time when I was specifically not thinking about the problem. In fact, it usually happens after I have been mentally active, but with something completely unrelated to the problem. It is as though the mental engagement elsewhere makes the erroneous assumptions vulnerable to reassessment.
I have been so enamored with this approach that I sometimes find myself simply expecting to get the solution and have claimed to various people at various times that I really am working—I am waiting for the solution. (To maintain employment, however, I don’t recommend that explanation to supervisors.)
So, what we can do is to recognize our stuck point, when the usual analytical approaches have completely failed, and at that point; stop, get away, and get involved in something else and preferably something enjoyable (see here).
In an hour or a day, the insight may just find you—because your brain knows what to do even when you don’t.
Ever the curmudgeon, I have just one more brief story. The first computer that I owned was the 6502 based KIM-1. I loved 6502 assembly language and while learning but I once hit a coding point that made absolutely no sense. I had an indirect jump instruction that did not, in fact, go where it was supposed to go. It did jump and it was repeatable and stable but it just didn’t jump to where it was supposed to jump. There was no insight solution and I ended up programming my way around the problem.
Sometime later, I was relating the episode to some programmers and the response was a dispassionate “Oh yeah, that’s the 6502 bug.” The early days of the 6502 processor had a bug in the microcode such that the instruction did not act as advertised.
There was no “Aha! moment” here, no “Eureka!” But it may have been the first of many such programming “Face Palm” moments – an entirely different effect.
Four lines solution.
Here is the solution to the four lines problem. The insight occurs when you realize that the lines can go outside of the square formed by the nine dots.