Click here to Skip to main content
15,920,383 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
Slacker0072-Dec-14 10:19
professionalSlacker0072-Dec-14 10:19 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 10:31
newton.saber2-Dec-14 10:31 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
Jeremy Falcon2-Dec-14 10:49
professionalJeremy Falcon2-Dec-14 10:49 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 10:58
newton.saber2-Dec-14 10:58 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
Kornfeld Eliyahu Peter2-Dec-14 10:50
professionalKornfeld Eliyahu Peter2-Dec-14 10:50 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
Jeremy Falcon2-Dec-14 10:52
professionalJeremy Falcon2-Dec-14 10:52 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 11:00
newton.saber2-Dec-14 11:00 
GeneralRe: BASIC Puzzle FINAL ANSWER Pin
newton.saber2-Dec-14 11:29
newton.saber2-Dec-14 11:29 
I know this is long, but it took me 30 years to figure this code out. Big Grin | :-D 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);
		// Console.WriteLine("encryptor value: {0} ", encryptor); // used in XOR
		string outWord = string.Empty;
		int elseCounter = 0;
		for(int x=1; x<strIn.Length;x++)
		{
			byte outByte = (byte)(Convert.ToByte(strIn[x]) - encryptor);
			// Console.Write(string.Format("{0} ", outByte));
			if ((outByte + encryptor) >= 65)
			{
				if (outByte < 65)
				{
					outWord += Convert.ToChar((byte)((outByte-26*-1)));
				}
				else
				{
					outWord += Convert.ToChar((byte)((outByte)));
					
				}
			}
			else
			{
				
				//outWord += Convert.ToChar((byte)((outByte+-11*33*(outByte^encryptor))));
				elseCounter++;
				if (outByte < 32)
				{
					outWord += Convert.ToChar((byte)((outByte-33*-1)));
				}
				else
				{
					outWord += Convert.ToChar((byte)((outByte)));
				}

				outWord += Convert.ToChar(outByte);
			}
		}
		// Console.WriteLine("**** STAGE 2 *****");
		Console.WriteLine(outWord);
		//Console.WriteLine();
		//Console.WriteLine("elseCounter : {0}", elseCounter);
		//Console.WriteLine();
		//Console.WriteLine();
	}
}

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.

GeneralRe: BASIC Puzzle FINAL ANSWER Pin
Jeremy Falcon2-Dec-14 11:41
professionalJeremy Falcon2-Dec-14 11:41 
GeneralRe: BASIC Puzzle FINAL ANSWER Pin
newton.saber2-Dec-14 11:46
newton.saber2-Dec-14 11:46 
GeneralRe: BASIC Puzzle FINAL ANSWER Pin
Dave Kreskowiak2-Dec-14 12:12
mveDave Kreskowiak2-Dec-14 12:12 
GeneralRe: BASIC Puzzle FINAL ANSWER Pin
kmoorevs3-Dec-14 3:26
kmoorevs3-Dec-14 3:26 
GeneralRe: BASIC Puzzle FINAL ANSWER Pin
Dave Kreskowiak3-Dec-14 17:26
mveDave Kreskowiak3-Dec-14 17:26 
GeneralRe: BASIC Puzzle FINAL ANSWER Pin
Andy Brummer2-Dec-14 15:54
sitebuilderAndy Brummer2-Dec-14 15:54 
JokeNatural Disasters PinPopular
Vivi Chellappa2-Dec-14 6:45
professionalVivi Chellappa2-Dec-14 6:45 
GeneralRe: Natural Disasters Pin
PIEBALDconsult2-Dec-14 7:08
mvePIEBALDconsult2-Dec-14 7:08 
GeneralRe: Natural Disasters Pin
Johnny J.4-Dec-14 23:15
professionalJohnny J.4-Dec-14 23:15 
GeneralRe: Natural Disasters Pin
jeron12-Dec-14 7:25
jeron12-Dec-14 7:25 
GeneralRe: Natural Disasters Pin
OriginalGriff2-Dec-14 8:00
mveOriginalGriff2-Dec-14 8:00 
GeneralRe: Natural Disasters Pin
Kornfeld Eliyahu Peter2-Dec-14 8:08
professionalKornfeld Eliyahu Peter2-Dec-14 8:08 
GeneralRe: Natural Disasters Pin
Deflinek2-Dec-14 8:28
Deflinek2-Dec-14 8:28 
GeneralRe: Natural Disasters Pin
jeron12-Dec-14 9:41
jeron12-Dec-14 9:41 
GeneralRe: Natural Disasters Pin
Slacker0072-Dec-14 8:14
professionalSlacker0072-Dec-14 8:14 
GeneralRe: Natural Disasters Pin
Jeremy Falcon2-Dec-14 8:36
professionalJeremy Falcon2-Dec-14 8:36 
GeneralRe: Natural Disasters Pin
Slacker0072-Dec-14 8:41
professionalSlacker0072-Dec-14 8:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.