A little over two months ago, Pradeep Soundararajan published a blog post about the importance of Testers learning to code. As a Perl enthusiast himself, Pradeep developed a puzzle Finding Nemo. He not only released it to the testing world, but also challenged testers to find the logic of the puzzle using Reverse Engineering.
Pradeep’s Nemo survived wear and tear and adverse climatic conditions while I carried it on my To Do list (a sheet of paper) for close to 3 months now. Time was ripe. Today was the D-day to solve the puzzle. Read on.
Mary had a little Lamb
The specification in the puzzle provided a gist of what Nemo does, figure out actual positions and logic behind Nemo’s changing positions. Re-reading the specification (4 times) gave me a new idea each time. First time, I got an idea about Nemo’s positioning by default. Second time, I got a feeler about how Nemo moves within the array. Third time, I was cognizant of the fact that other fishes move to different positions every time the position of Nemo is guessed. Fourth time, I was happy to know that the order of all the fishes will be revealed if Nemo’s position is guessed correctly. ‘Mary had a little Lamb’ heuristic from the book Exploring Requirements was of great help.
The minimum number of attempts to guess the position of Nemo is set to 10. At first glance, I thought 7 was good enough as there were 7 fishes. 10 might be a trap as it includes 3 attempts more. I accepted the default setting as it was simple and would help me track Nemo’s progress with respect to his friends:
1. First guess - 1 i.e., Nemo would be in the first position. Bingo! I found Nemo in 1st position. Now, I was more interested in the order of the fishes – Nemo, Gill, Bubbles, SharkTooth, Flow, Phamplet and Stinger. I noted down the order in MS Excel.
2. Second guess - 2 assuming that Nemo would move linearly to the next position. I was wrong. What next?
3. I tried a monkey trick. Instead of guessing Nemo’s positions in the next 8 attempts, I closed the program. I ran the program again and entered 1 again. I found Nemo again. You may ask ‘Not a big deal, you found this in Step 1 above’. You are wrong. It was big deal for me. Note that every time you run this program, Nemo’s position is intact. This is unlike the Minesweeper game where the mines are placed differently each time the user clicks on the smiley button or the game is re-started.
4. Firstly, I got the order of the fishes in Step 1 above. Now I know that Nemo’s position doesn’t change if I restart the program. I thought ‘This puzzle is not as difficult as I thought it was’! Excitement? Yes. Over-confidence? No.
5. As a follow up to Step 3, my second guess was 1. Maybe Nemo was too sleepy to move. You never know. I was wrong again.
6. Closed and restarted the program. First guess – 1, Second guess – 3. Boom! Nemo had jumped to the third position. Third guess – 1. I decided that going forward, I’ll guess the positions one by one without mixing up too many things in my mind. My note taking skills were of good help here. Closed and re-started the program.
7. First guess – 1, Second guess – 3, Third guess – 2. FAIL
8. First guess – 1, Second guess – 3, Third guess – 3. FAIL
9. First guess – 1, Second guess – 3, Third guess – 4. FAIL
10. First guess – 1, Second guess – 3, Third guess – 5. PASS
11. First guess – 1, Second guess – 3, Third guess – 5, Fourth guess – start from 1 to 7 until I find Nemo’s position
12. First guess – 1, Second guess – 3, Third guess – 5, Fourth guess - 3 . PASS. What? Nemo jumped backwards? How could he do that? Cheater! Oh No. Nemo can move in any direction he wants. It’s after all a Perl array (a big sigh). Closed and re-started the program.
13. First guess – 1, Second guess – 3, Third guess – 5, Fourth guess – 3, Fifth guess - start from 1 to 7 until I find Nemo’s position.
14. First guess – 1, Second guess – 3, Third guess – 5, Fourth guess – 3, Fifth guess – 2. Closed and re-started the program.
18. Refer to the excel for successful guesses of Nemo’s position HERE
Was I done? Do you remember the mission? The mission was to guess the position of Nemo in the array and reverse engineer the logic behind Nemo’s movements. I was only 50% done. Some of us would have forgotten the second part of the mission by now. Always take note of the mission at the beginning of the session. This helps to focus on the mission and avoid traps.
I knew how Nemo moved from time to time as summarized in the Excel. I kept staring at Nemo’s position again and again. I did not see anything prominent. Let’s use some colors and beautify the report with some greens and reds and yellows. This feeling pepped me up. I highlighted Nemo’s position in green. I was looking for a pattern. I didn’t see one. What the heck? I have pretty much guessed the puzzle. Isn't it?
I grabbed a fresh cup of coffee to celebrate achieving the first part of the mission. After all, the first part wasn’t that hard. The aroma coming from the fresh coffee spruced me up. I kept staring at the excel, this time focusing more on the green bars where Nemo was positioned. I then looked at the order in which Nemo moved – 1, 3, 5, 3, 2, 7, 3, 4, 7, and 4. Does the logic have something to do with arithmetic progression?. I am not good at Math, but sufficiently good enough to remember harmonic progression from my 8th grade. I did some calculations to see if there was any relation between this and the logic. No luck on the logic. No luck with the coffee as well. It was as cold as my mood.
Let’s be practical. Nemo can’t be best friends with all 6 fishes. Some were his best friends, some good and some not so good. So he would obviously hang out with friends who he was most comfortable with (fishes have a human side too and humans have a fishy side! Haven’t you watched the movie yet?). Enough of staring at the Excel. It was time for the Blink Test. After all, I had to put to use, my little knowledge gained reading Malcolm Gladwell’s book Blink – The Power of Thinking without Thinking. I took a quick look (blink) at Nemo’s positions and realized that Nemo hangs out with Phamplet, Gill and Bubbles most of the times. Aha! Now that's a cool finding. On careful observation, I saw another surprising behavior. On the 1st, 3rd, 5th, 7th and 9th attempts, Nemo positioned himself just before Gill(who was followed by Bubbles). On 2nd, 4th, 6th, 8th and 10th attempts, Nemo positioned himself before Phamplet who was followed by Gill and Bubbles. So, Nemo found comfort in the company of Phamplet and Gill most of the time and hence followed them who in turn had their own comforting friends.
Michael Bolton in his RST workshop talks about the importance of sneaking in, breaking the rules, watching the states carefully, monitoring the change of states, using visual/auditory/tactile skills and making snap judgments. Cognition to these has helped me learn to test better day by day. Break the rules. Sneak it. It’s ok for Testing’s sake.
Did I get it right?
Is this the right logic? Was I good enough in solving the puzzle? My answer is “I don’t know”. All I know is I thoroughly enjoyed solving the puzzle and travelling through an amazing journey of sneaking in backdoor, applying harmonic progressions, recognizing Nemo’s comfort zone and last but not the least blinking. I would still not mind if I am wrong for 1 reason: I tried and that makes a big difference to me. Come – Join – Make a Difference – NOW.
Do tell me what you think about my answer while I rush to Pradeep’s blog to read what Shmuel and William have to say.
I just read what Shmuel Gorshon and William Fisher had to say about the puzzle. I am so hurt about my problem solving skills!
9 days later…………
After feeling terribly embarrassed and hopeless about my effort at solving a puzzle (Don’t forget I have been poor in solving puzzles in general – looks like a red flag for me), I decided to learn how Shmuel and William nailed the problem.
I was kind of close to Shmuel in that my initial approach was good. What I lost on the way was to figure out if my solution worked for attempts greater than 10. At this point, I am thinking that playing around the puzzle with a few different attempts would have thrown some light on my understanding.
One important thing is Shmuel used many tools to aid and speed up the testing process. He starts off with Note Taking. Shmuel smartly used some automation tests to really try out umpteen attempts. “Don’t be afraid of automation. It can help you talk with the software in different ways and interact with it differently. It helps a lot with data generation and logging, too. Never let the automation take control of the testing. It is there to help you, not to drive the effort.” hints Shmuel. This is exactly how I feel about automation – Afraid.
The excel spreadsheet that he built is a mind boggling oracle to compare the puzzle against. This is one of the coolest manifestations of oracle I have witnessed. And I loved his storytelling report. Awesome appears like a very small word to commend what he has done with the puzzle. Well Done Shmuel. Great Work!
I liked William’s approach as well. His constant search for the right tools made me appear so dumb for not even thinking about the tools. I was unable to view the video, so I can’t talk much about his strategy yet.
Oh! The log file. The first time I was upset was when I saw that I did not do as well as Shmuel did. The second time was when I learned there was a log file that I missed. If the log file were a human, I might have assaulted it yelling ‘Why didn’t you show up when I needed you the most?”. Jokes apart, I did not look for it until Pradeep enlightened me about it.
Many of us grow up with a “You cannot blame me for things I don’t know. That is not fair” attitude. If only we kept our egos aside and be more open to learn, then we could become the most intelligent humans our near and dear ones would ever witness.
Striking the Right Balance
One video brought me back to my senses. Click HERE.
It’s Better to Try and Fail Than to Have Never Tried At All
Post a Comment