This week's book giveaway is in the Design forum.We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!

# Secret code

HS Thomas
Ranch Hand
Posts: 3404
I found this snippet of code which sets out deliberately to confuse.
Can you find out what the code does ? Eventually I'll post where I found this from and give credit where it is due.

The code is in C. The key is in
char a[ ] = "ABCD"; /* string representation */
char b[ ] = "\x41\x42\x43\x44"; /* hexadecimal representation */
char c[ ] = "\101\102\103\104"; /* octal representation */
char d[ ] = "A" "B" "C" "D"; /* using string properties */
char e[ ] = {'A', 'B', 'C', 'D', ' \0'}; /* using char propery */
In C all the above strings a, b, c, d and e represent �ABCD�.
I'll post the answer soon. I thought I'd just give someone the pleasure of finding the answer.

Here is the code again, resembling code this time in case people were trying to read it South Pole top-wise, following Bert's advice about globes.
Run the program as <program name> int1 int2
where int1 and int2 are integers between -180 and 180.
Ok, Ok , the integers are latitude,longitude and the program gives their location in a way.
Try 38 and -122 for San Francisco.
regards
[ September 01, 2003: Message edited by: HS Thomas ]

HS Thomas
Ranch Hand
Posts: 3404
The solution is in danger of going unposted.
Well, I've tried and don't get any output and can't explain how it works.
There's no fun in posting a solution when no one has tried.
regards

Michael Dunn
Ranch Hand
Posts: 4632
I don't know how it works, but the output is a (flat) map of the world.
It is quite clever - I just wish I was clever enough to understand how it worked.

HS Thomas
Ranch Hand
Posts: 3404

At least you got it to run.
Quite an OBE (Out of Body Experience).
I better post the link to the solution then.
Enjoy!

Obfuscated Code
Notice how the graemlins lie in an orbit like planets round the world.
Another OBE!
regards
[ September 02, 2003: Message edited by: HS Thomas ]

Michael Dunn
Ranch Hand
Posts: 4632
It runs OK on Windows XP, but crashes on Win98.
This is a real memory jog/guess - 16 bit unicode Vs 8 bit unicode?

HS Thomas
Ranch Hand
Posts: 3404
Well ,I'm trying to run it on XP. Unless the output is being directed elsewhere, I'm not seeing any.
regards

Michael Dunn
Ranch Hand
Posts: 4632