In 1990 Brian Westley wrote one of the most beautiful computer programs I’ve ever seen. It was submitted as an entry to the International Obfuscated C Code Contest and won the “best layout” award.
Its reads as messages back and forth between two ex-lovers, Charlie and Charlotte.
I think I first saw this in an IRC trivia channel around the turn of the millennium when I was just starting out with programming. Seeing the output it generated blew my fucking mind. I’ve included it at the bottom of this page.
Here’s the code, which reads almost as English, with newlines removed for brevity:
char*lie;
double time, me= !0XFACE,
not; int rested, get, out;
main(ly, die) char ly, **die ;{
signed char lotte,
dear; (char)lotte--;
for(get= !me;; not){
1 - out & out ;lie;{
char lotte, my= dear,
**let= !!me *!not+ ++die;
(char*)(lie=
"The gloves are OFF this time, I detest you, snot\n\0sed GEEK!");
do {not= *lie++ & 0xF00L* !me;
#define love (char*)lie -
love 1s *!(not= atoi(let
[get -me?
(char)lotte-
(char)lotte: my- *love -
'I' - *love - 'U' -
'I' - (long) - 4 - 'U' ])- !!
(time =out= 'a'));} while( my - dear
&& 'I'-1l -get- 'a'); break;}}
(char)*lie++;
(char)*lie++, (char)*lie++; hell:0, (char)*lie;
get *out* (short)ly -0-'R'- get- 'a'^rested;
do {auto*eroticism,
that; puts(*( out
- 'c'
-('P'-'S') +die+ -2 ));}while(!"you're at it");
for (*((char*)&lotte)^=
(char)lotte; (love ly) [(char)++lotte+
!!0xBABE];){ if ('I' -lie[ 2 +(char)lotte]){ 'I'-1l ***die; }
else{ if ('I' * get *out* ('I'-1l **die[ 2 ])) *((char*)&lotte) -=
'4' - ('I'-1l); not; for(get=!
get; !out; (char)*lie & 0xD0- !not) return!!
(char)lotte;}
(char)lotte;
do{ not* putchar(lie [out
*!not* !!me +(char)lotte]);
not; for(;!'a';);}while(
love (char*)lie);{
register this; switch( (char)lie
[(char)lotte] -1s *!out) {
char*les, get= 0xFF, my; case' ':
*((char*)&lotte) += 15; !not +(char)*lie*'s';
this +1s+ not; default: 0xF +(char*)lie;}}}
get - !out;
if (not--)
goto hell;
exit( (char)lotte);}
When you run it, giving it a number, it outputs:
$ ./charlotte 4
./charlotte
loves me
./charlotte
loves me, not
./charlotte
loves me
./charlotte
loves me, not
A more in-depth look at the code and its execution can be found at https://nickdrozd.github.io/2021/03/30/signed-char-lotte.html.
The original code is hosted at https://www.ioccc.org/1990/westley.c.