# Scamming programmers with Guess

By Frederic Friedel

When computers entered our homes, in the late 1970s, I perpetrated a great computer scam: the company Commodore had received a delivery of their first “home computers”, and I packed a professor of computer science from the University Hamburg into my car and drove down to their office. There we sweet-talked the CEO of Commodore into giving us one of the three sets he had, to explore the possibilities that lay in the machine, and report our conclusions to him (he had only vague ideas on what these things were going to be good for).

As a fledgling student at University I had done a little bit of programming, but in Fortran and other prehistoric languages you have never heard of. With the Commodore PET I was confronted with “BASIC” for the first time. Luckily we had a friend from the US over at our house, a 15-year-old boy, son of a famous computer pioneer. Together Corey and I figured out how to run the built-in Basic compiler, and after considerable study — many hours, in fact — we became quite adept at writing little experimental programs. I was pleased to discover that he possessed a devious kind of humour that sometimes displayed touches of pure evil — just like me.

Our first memorable program was “Guess”. This was a game where the computer would ask you to guess a number between one and a hundred. When you typed one in it would tell you if your guess was too high or too low, and you could guess again. In the end it congratulated you for finding the correct number, and told you how many guesses it had taken.

At the time we had waves of friends visiting us, older and far more advanced in computer science. They came to see the home computer — the only thing they knew were mainframes occupying a wall and weighing more than a ton. Of course we showed them “Guess”. They thought it was cute- But there was a problem: when one of them played the game, and then Corey or I did the same, we would inevitably beat them, finding the number in one guess less. If they needed seven tries — you know, 50? 25? 12? 18? 21? 20? 19! — then we would do it in six. If they were lucky and did it in four, we did it in three.

Naturally they became suspicious. Soon we were not allowed to operate the machine, not type in the numbers, since there may have been a way of doing this that told the machine to favour us. We had to say the numbers, and they typed them in. They made sure we were not using a pattern in our guesses to tell the machine it was us. They varied the rate at which they entered the numbers, so that information could not be passed through timing. They restarted the machine and the program themselves, and we were not allowed within a yard of it. And yet we kept winning, and they kept tearing out bushels of hair.

The advanced programmers came in separate groups, and then together, trying to communally work out how we were doing it. Clearly, they said, the computer had a sequence of number we knew, or we were able to deduce the next number from the ones it had previously chosen. In long experiments they filled pages and pages of numbers and tried to figure out our system. But it all came crashing down when they hid the previous numbers from us. We still found the next number in one try less than them. They could play ten games in a row, privately, after which we were allowed into the room and still we got it faster than their last attempt.

All this drove them mad — I believe one still has a facial tic from that experience. Someone even muttered something about supernatural powers and numerical precognition. But they didn’t find out, even after one group insisted we showed them the BASIC source code. Corey and I reluctantly agreed, and on one visit typed “List” for them. The program appeared quite straightforward: generate a random number, r, between one and a hundred, input a, if a>r print “Too high”, etc. Perfectly legit. Except for one line, which read “If input Fred goto…” and sent the program into a special subroutine that allowed us to win. “What the hell is ‘input Fred’??” they almost screamed, “how is that supposed to work?” — “Don’t know,” I replied, “it doesn’t explain it in the manual. It simply works.”

Before they had to be transferred to a psychiatric ward we confessed that this part was just a joke: Corey, who was evil (did I mention that?), had written a program to simulate the Commodore BASIC compiler, so when you typed “List” it showed you code that was not executed when you ran “Guess”. Screams of anguish, but they were still completely befuddled by the game itself, and unable to figure out how we managed to win almost every single time. We did not show them the real program, although Corey worked for a while to hide the one line of code in such a way as to allow us to do even that.

Okay, now for the solution. But perhaps you would like to think about it for a moment. How did we do it? Scroll down if you give up and want to be told.

.

.

.

.

.

.

.

So here’s the solution, which you will find disappointingly simple. But remember, it was able to fool highly qualified and intensely motivated computer people for months. What Corey and I did was to make an intro screen which appeared at the start of each game. It said: “Guess — a game of strategy and mathematical skill. The computer asks you to guess a number between one and 100, and will tell you… bla, bla, bla.” It pretty much filled the screen. When it appeared we would start to mentally count seconds, and at a specific time, after four seconds, two characters in the text would briefly switch to the (genuinely) random number the computer had selected. Briefly means for I think one eighth of a second — we tested it out and found the shortest possible time for us to recognize the number. Of course nobody else saw it — screens at the time had low refresh rates and consequently a certain flicker. But mainly the others didn’t know where to look and when to do so. The scam worked beautifully, nobody came close to figuring it out.

There is one technical point: what happens if you miss the eighth of a second, and do not see the number? There are so many ways to restart. “Hey, did you see that? A wild hare running through our garden! The second time today. Amazing!” Or you mumble 21 and when the operator types it in you protest “I said 31!” — anything to start the game again. Or you simply guess, like everyone else. In fifty percent of the cases you win, and when you don’t you talk about how precognitive skills do not work 100% of the time, or that certain vibes were disturbing you. On a few occasions the people we were scamming did not let us see the screen at all — they were on the right track. But we simply guessed and were lucky. After you win two out of three they readily abandon the theory and start looking for something else, especially if you use distracting patter.

That is how easy it is to fool intelligent, critical people, how two absolute amateur tricksters are able to hustle bona fide programmers. Can you imagine how the world is open to professional fraudsters, con artists and miracle psychics. More about that in separate articles.

## More from The Friedel Chronicles

Frederic Alois Friedel, born in 1945, science journalist, co-founder of ChessBase, studied Philosophy and Linguistics at the University of Hamburg and Oxford.