Introduction to Artificial Intelligence

Programming Project 2
Due: Oct. 3, 1997

Contents

The Story

"Most people don't realize just how dangerous Computer Science really is." These words were perhaps the first I heard back in those days when I was beginning my training. I remember chuckling at the implications, never realizing how true those simple words were. Now, as one of the most feared covert operatives in the Computer Science underworld, I deeply understood the phrase. It had become my personal motto.

I finished the tap and checked my wrist-radar. So far all clear. The trunk of fibre-optic cable which the Swiss Banking network relied on as their primary TP-2 communications feed was only accessible after digging a half-kilometer tunnel through solid rock. There was a chance that even the most sophisticated muffling technology at my disposal would not completely hide the sound of the shaped charges as they did their work, but I seemed to be in the clear for the moment.

Once complete, I had to hide the job as well as possible. The longer the tap remained undiscovered, the longer I would have access to all the money in Switzerland, and I happened to know (through my previous mission) that several Columbian "Coffee" Moguls had just made fairly large deposits. I had no doubt my conscience would not bother me after making a few withdrawals on those accounts. Maybe I'd donate some of it to a rehab joint.

I dusted off my tuxedo and surveyed the landscape. It looked pretty good, you'd have to be looking pretty closely to notice the shards of rock were not natural. Satisfied, I hopped into my helicopter and flew back to my castle in Bavaria. The real hard work was about to begin, the Swiss use an encoding mechanism of their own on top of the standard banking encryption algorithms, and I only had part of it. Hopefully I could overcome this lack of information with raw computing power - I had several plasma cooled supercomputers in the dungeons of my castle, not to mention access to the NSA decryption network back at Langley. If it could be broken, I would break it.

Before the fun, I had some social matters to attend to. I had been invited to the Formula 1 reception in Monte Carlo, undoubtedly the biggest social event in the world. Since I was just signed on by the Williams/Renault team as their primary driver, I was required to be there. The blasting had taken me longer than I had expected, so a fun drive in my new Ruf modified twin-turbo 911 Carrera was no longer an option, only the Learjet would make it in time.

At the reception, I was as usual surrounded by a crowd of people who had no idea who I really was. The Prince (who was actually a pretty funny guy) and I were swapping racing stories when I noticed a familiar figure at the bar. Although my extensive training in Analysis of Algorithms insured that externally I gave no hint of it, my heart stopped beating for a few seconds - it was Pierre Francois, aka the blackbird, notorious assassin and terrorist. He was an expert in small arms, hand to hand, heavy artillery, and computational complexity. He was also my arch-nemesis. I had no idea how he could have gotten into the small country, but that didn't matter.

I was sure he knew I was here, mainly because he was the only person in the ballroom who paid no attention to me. I had to act, and quickly. I politely excused myself from the Prince and intercepted Pierre in a small crowd. I decided that he would probably not want to make a scene in such a public place, and I knew how his intensely competative nature would compel him to respond to what I was about to say.

"Don't I know you? Jean-Luc was it?" I said to him, my hand outstreched. I was basically giving him the chance to give aloud the same name he had given to get in, and undoubtedly to others in the room already. Try not to put the enemy on the defensive too soon, I remembered learning that in Data Structures.

"Jean-Richard," he replied, eyeing me suspiciously.

"Of course!" I pretended to be glad to see him. "My apologies. But of course you must give me the chance to win back my money!" I turned to the curious onlookers. "Last time we met he took me for fifty grand at gin!" The remark produced knowing smiles. "Name the game, my cunning friend, and we'll make it double or nothing!"

Pierre knew that, by local custom, no man who had won money from another in a game could refuse such a challenge. And at this point, too many people had seen him, so he couldn't take any action. I was surprised, however, to see him give a quick smile.

"If I'm to call the game, sir," he said. "Then it is to be connect four."

"Connect four? What the hell is that?" I turned for sympathy to the growing crowd around us. An opportunity to gamble was never missed at these gatherings.

"Certainly you did not expect me to suggest we race for it?" Pierre retorted. His quip sent a ripple of laughter through the crowd. He had caught me off guard, he was familiar with my own persona and thus had trapped me. Damn, that had all been covered in Operating Systems.

I reluctantly nodded assent. "Never having heard of the game, I don't have one handy," I said.

He smiled to reveal his gold fillings. "I do."

I was lying a little. I knew how to play connect-four, and my pocket data assistant just so happened to have a minimax game-playing shell built in - all it needed was a heuristic module for the specific game. I could not, however, simply sit down and begin programming. Pierre began to set up the game and explain the rules to everyone. I pretended to listen but secretly sent a coded message to CIA headquarters requesting they quickly code up a heuristic and download it to my pocket computer. I could only hope they would get it in time. I could not afford to lose this game...

The Game Connect-4

The rules for connect-four are simple. The game is played on an upright seven column board. Each column has six spots. Two players play by alternately dropping a chip down one of the columns. The chip drops to the lowest unoccupied spot in that column. The first player to get four chips in a row, either vertical, horizontal, or diagonal, wins. The game ends in a stalemate if it fills before someone wins.

A connect-four board might be displayed as follows:

NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
RED NIL NIL BLK NIL NIL NIL

Here's another possible board (there are many):
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
RED NIL NIL BLK NIL NIL NIL

The following board is not valid, since columns must be filled from the bottom up. There can be no empty slots between two occupied ones in the same column:
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
RED NIL NIL BLK NIL NIL NIL

The following board shows one player a victor:
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
NIL NIL NIL NIL NIL NIL NIL
RED NIL NIL BLK NIL NIL NIL