I know this is long, but it took me 30 years to figure this code out. Seriously.
Thanks To All
First of all, thanks to everyone who contributed information.
Everyone got me looking at the odd code (N<32) and thinking about it differently.
The big trick was that old BASIC considers -1 (negative 1) to be value for TRUE.
That was the KEY to solving this.
Coleco Adam
The code is from a program found in a magazine (Family Computing) from November 1984. I was but a lad then and owned my first computer a Coleco Adam[^]. I didn't know anything but tried to type this program in and it never worked.
Flash Forward to Now
30 Years later I did a google for Lapis Lazuli Coleco Adam and someone has archived the magazine online. CRAZY!!! I guess I've just always thought of this because it was my first programming experience.
You can see it here:
THe Case of the Missing Lapis Lazuli[^]
I just had to know the answer to the Mystery. Why didn't it work? And what were the real words that the data represented?
Old BASIC Code
I started examining the code and the first thing I found out was that the TI-99 code was the nicest so I used it to try to crack the code.
If you want to just see the code listing look at this page of the article (left page)[^]:
Cracked The Code- Rewritten In C#
If you have the great LINQPad C# TOOL[^] you can copy my final code below and run it and see the data is cracked.
The original data looks like:
4000 DATA 3,THINBCHA,BURGEKCN,TUVI0N,4,CMKHUH*V
4010 DATA KABGUVAT,SYBLAR,6HIVBA,S,HLBH4ER,KHLDETYR
4020 DATA NHCIF,NHWAS,KHTES,5,PIXUHBESA,FNUfiSKY
4030 DATA HJBHYQA4G,SUX,CHADPLQLeJ,1 ,HPYBPX,1 ,DAEXGL
4040 DATA 1 ,8YTKUVYCVEJ,1 ,C5=7<1 ,1 ,HZVEEBE,1S
4050 DATA DGSVVI6X):,AQIPUP,J=,LIME,GAHRLU,IRW,SMAX
4060 DATA dqhvvsv2,fznk,satgwl,hba,kesp,twfiwe,h-ij:h
4070 DATA CUHYHUVHG1,4,HERSYRPG,LAZ,TNBY,I8LNWN7
There's an interesting part of the algorithm which reads the integer from the data, determines that is the number of words that it should read, then it reads the next N data items as words.
You can see all of this in the code at the previous link.
Here's the final C# code just to decrypt the data.
void Main()
{
string [] allStrings = { "THINBCHA","BURGEKCN","TUVION",
"CWKHUH*V","MABGUVAT","SYBLAR","GHIVBA",
"MLBH4ER","KHLDETYR","NMCIF","NHWAS","KHTES",
"PIXUHBESA","FNURSKY","MJBHYQA4G","SUX","CHADPLQLQJ",
"MPYBPX",
"DAEXGL",
"BYTKUVYCVEJ",
"C5=7<1",
"MZVEEBE",
"DGSVVIGX%","AQIPUP","J=","LIME","GAHRLU","IRW","SMAX","DQMVVSV2","FZNK","SATGWL","MBA","KESP","TWFIWE","HIZM","CUHYHUVHG1",
"MERSYRPG","LAZ","TNBY","IBLNWN7" };
foreach (string strIn in allStrings)
{
byte encryptor = (byte)(Convert.ToByte(strIn[0]) - 64);
string outWord = string.Empty;
int elseCounter = 0;
for(int x=1; x<strIn.Length;x++)
{
byte outByte = (byte)(Convert.ToByte(strIn[x]) - encryptor);
if ((outByte + encryptor) >= 65)
{
if (outByte < 65)
{
outWord += Convert.ToChar((byte)((outByte-26*-1)));
}
else
{
outWord += Convert.ToChar((byte)((outByte)));
}
}
else
{
elseCounter++;
if (outByte < 32)
{
outWord += Convert.ToChar((byte)((outByte-33*-1)));
}
else
{
outWord += Convert.ToChar((byte)((outByte)));
}
outWord += Convert.ToChar(outByte);
}
}
Console.WriteLine(outWord);
}
}
After that I can figure out the answer to the puzzle. Even though it is in weird order and there are still a couple of scrambled ones--- due to my mistyping or something.
Lapis Lazuli Puzzle ANSWER SPOILER ALERT!!!!
NOTHING
SPECIAL
ABOUT
THERE''S
NOTHING
FISHY
ABOUT
YOU''RE
WASTING
YOUR
TIME
WITH
SHERLOCK
HOLMES
WOULDN''T
BE
EXAMINING
CLOCK
WATCH
WRISTWATCH
22::4499..
MIRROR
CORRECT!!
PHOTO
33
WAS
TAKEN
IN
THE
MIRROR..
THE
HANDS
ON
THE
CLOCK
ARE
REVERSED..
REFLECT
ON
THE
SCENE..
modified 2-Dec-14 17:50pm.
|