20 GOTO 10

I have secrets to tell you, gather round and listen closely.  Look at the picture below, this is the screen of a bygone era.  The blinking cursor.  It is responsible for the success of the software industry in Great Britain.

Why?  Keep looking at it.  In the 80’s this is all you got.  No nice menus, no graphical user interface, just the blinking cursor.  It’s there, ready, waiting for your input, waiting to obey your commands, without you the computer is nothing.  It needs your input to be anything.

This simple fact gave you the feeling that the computer was watching you, and this feeling would work upon your mind and lure you into trying to make it do something.  Anything, it didn’t matter what.

The desire to make it do something motivated a lot of people to learn a few basic commands.  Those people then went on to be great programmers and had long and successful careers in software.  Maybe you, reading this, now stand upon that same precipice?

It may amuse you to learn that the first program most of my generation learnt was one designed to annoy the teacher.  This, simple, program has entered software programming lore and popular culture.  You can even buy t-shirts with it on.

10 PRINT "PROFANITY ";
20 GOTO 10
RUN
PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY PRO
FANITY PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY PROFAN
ITY PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY
PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY PRO
FANITY PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY PROFAN
ITY PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY
PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY PROFANITY PRO

This would basically fill the screen with your favourite swear word!  Apart from doing it in high street shops, like Tandy and Dixons, most people would do this when the teacher left the room for a moment.

If you were really clever you would also enter two commands before your program, this would disable the Escape key and prevent the teacher from aborting the program using the Break key.  Maximum annoyance!  They would have to power cycle the machine.

*FX13,6
*KEY 10 "OLD |M RUN |M"

I personally think it would be a huge shame to deprive today’s teachers of this same prank.  Especially since you can bet your grandmother that your teacher probably pranked their teachers in exactly the same way 20 years ago.

Here is how to do it on a Raspberry Pi

With practise you will be able to do this really quickly, perfect for when a friend steps away from their keyboard for a moment.  When at the Linux command prompt, so you can see the blinking cursor, enter the command python (see below).

pi@raspberrypi ~ $ python
Python 2.7.3 (default, Jan 13 2013, 11:20:46)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> _


When you see the three arrows above with the blinking cursor enter the code below exactly as it is shown. Importantly note that on the second line there is a tab (image above, look on the left above Caps Lock) just before the print command!

>>> while True:
...	print "PROFANITY ",

Press enter a few times and you should see the screen fill with your chosen message!

You may notice that if you have chosen a four letter word that it fits into neat columns and rows on the screen, you can modify this by including a space character at the end of the message.  Then you see a kind of unreadable blur which is like a profanity time bomb waiting to go off.  You can press Ctrl – C to stop it whereupon the message becomes readable.  Ctrl – D to exit python and go back to Linux.

Now, if you really want to grief someone then read on.  Here is the version where you can’t stop it!  Well, actually you can but it’s harder and often requires a reboot.  Be sure to use the tab key to lay out your code exactly as it is shown here.  This is a fundamental principle of the python programming language.

>>> while True:
...	try:
...		print "PROFANITY ",
...	except KeyboardInterrupt:
...		print "MORE PROFANITY ",

You can sometimes manage to abort this program by button bashing Ctrl – C.  But otherwise to stop it safely press Alt – F2, login again and type sudo reboot to restart the Pi.

Good luck and please post below if you either have any improvements or you manage to prank your teacher!