Back in school, we had ‘Computer Science’ as a subject and even had a lab. We were expected to learn programming in the lab, but I spent most of the lab time playing games like ‘Prince of Persia‘ and ‘Dangerous Dave‘. The teacher in charge of the lab didn’t like it one bit, and had threatened to flunk me several times.

At the end of the year, we had to do a ‘Computer Science Project’ to prove we learned something during the year. Someone decided to do a project on the solar system, some others decided to make a database project for storing student records - Everyone of them on their way to becoming software engineers.

I decided I wanted to write a video game.

Me:Ma’am, I’m going to write a video game - I’m going to write a program that plays ‘Tic Tac Toe’!
Teacher: Your program will play Tic Tac Toe against me? That sounds like a dumb project.
Me:No ma’am: I’m going to use Artificial Intelligence in my program. You won’t be able to win against it.

Have I told you guys that I had a very big mouth? I had absolutely no idea just what the hell Artificial Intelligence was, but that didn’t stop me from loudly declaring that my program could not be beaten.

Teacher:Really? OK. If your program can defeat me, you’ll pass.

At this point, most people would try to research the problem to see if such a program was even possible. But I decided to take the high road. My program would cheat to win.

I wrote up this program that would put the ‘X’s in two boxes simultaneously if it was about to be defeated. And of course, it would let the user put only one “O” at a time. Oh, it was brilliant!

And so, the day of the final exam came and we were lined up to show our programs. The teacher walked up to my computer and said “Ready? Remember, Only if your program doesn’t loose, you pass.

I started up my program. The game came up and the teacher started playing. The teacher chose ‘O’s and the computer was playing with ‘X’s. Soon, she had the program cornered. The board looked like this with the computer to place an ‘X’.

O |   | X
----------
X |   |
----------
O |   | O

The teacher was probably snickering to herself. She thought she had two possible winning positions, and she was going to beat my program. But before she could realize this and say something, the computer came back and put 2 Xs simultaneously. Now the board looked like this:

O |   | X
----------
X | X |
----------
O | X | O

The teacher was shaken for a minute. She couldn’t figure out what was going on. She thought she had misread the earlier board or missed something! She stared at me, trying to see if I had pressed a key or somehow changed something, but I was standing away with my hands behind me. I couldn’t have done anything. She definitely suspected I had cheated, but the thought that the program was cheating didn’t cross her mind.

She grunted, placed an ‘O’ at the top, and the program came back and placed the remaining ‘X’ and declared that it had beaten the teacher! It even played victory music through the speaker. The crowd in the lab cheered and the teacher walked away disgruntled, still trying to wrap her head around how she could have lost to a computer program! Was it smarter than her?

She eventually did pass me, but I don’t think she ever figured out what exactly happened that day in the lab.