last day (15 days later) » 

07:07
29
A: How did Commodore's anti-Microsoft Easter Egg work?

Zac67LOL - I don't think that's an easter egg. Someone just made an effort to find random seeds that produce the numbers to create the intended words. It would be an easter egg if the seed numbers were in some way related to CBM or Microsoft. A=RND(-A) initializes the (pseudo) random generator with A...

Plus, why would Commodore hate Bill Gates and/or Microsoft? Commodore got the deal of the century with CBM BASIC (compared to other vendors). If anything, it should say "BILL GATES ROCKS". lol
That effort must be quite considerable, given the speed of the CPU, and it was quite a lucky coincidence. The probability of a random sequence of six elements admitting 22 values to produce the specified 6 values ("GATES" plus a terminator or "SUCKS" plus a terminator) in order is 1 over 113,379,904. There is only 50% chance to encounter the necessary combination within log(1/2)/log(1-1/(22^6)) = 78,588,960 attempts, and the 90% chance is reached at 261 million. However, I had to go higher than 300 million to find "GATES" in the GNU LIBC random().
@LeoB. Did you disassemble the Commodore RNG to find the algorithm? I would guess it's based on a simple linear congruential generator. In which case, a bit of mathematics can replace a lot of trial and error! The algorithm that GNU LIBC uses is irrelevant to the OP's question!
@LeoB. Presumably they used a emulator, or even wrote their own version of the C64 random number generator and ran it natively on a modern PC.
@alephzero Any sufficiently random pseudo random number generator will produce the strings with the right seed, so the actual algorithm used doesn't affect the chance of finding the right seed.
@Leo B. An emulator can run at a speed several orders of magnitude higher. Maybe they used reverse engineering of the code - given the size of the code, that's probably the fastest approach. I'm pretty sure this "easter egg" is an inside joke.
07:07
I would be amazed if they found the magic number 22 in "A = INT(RND(A)*22) by chance, without knowing the Commodore PRNG algorithm.
@alephzero Not by chance, but simple brute force testing seeds, from 1 until you find one that works.
@alephzero I've also used trial and error. It doesn't really matter what algorithm is used, statistically they must behave the same if they claim to be random enough. If it is a recent "discovery", then no surprise: it does take only a few minutes to run the search.
@alephzero The magic number 22 is the number of letters between A and U inclusive, plus one. It is the minimum needed to produce all possible letters in "BILL GATES SUCKS" plus the terminator.
@RossRidge But if you know the algorithm (by disassembling the ROM) why would you want to do this by brute force, when you can use math instead? If this is really an easter egg, then it was created using hardware that ran at 1980s speeds, not a modern PC.
@alephzero The 22 is just the smallest number (producing the narrowest number spread) able to produce the indices required. ASC("U") is 85, minus 64 is 21 plus 1 (for the 0 as stop code) is 22. Ha - Leo beat me!
" it does take only a few minutes to run the search." - maybe so, but one of the banes of my "day job" is people who write programs that run 1000 times or even 100,000 times slower than they need to, because the only algorithm they know to solve any problem is "brute force."
07:07
@alephzero It's not a cryptologically secure random number generator so figuring out required seeds is through math is possible, but doing the math isn't easy. On the other hand it's very easy to have a computer brute force it while you do something else.
@cbmeeks Change the 17059266 to 1635831 for it to say RULES instead of SUCKS.
Do you really want to blow peoples' minds? Someone come up with a program that displays "ZX SPECTRUM RULES!" and pass it off as another hidden Easter egg. lol
@cbmeeks: In response to your first comment, the article says that Commodore's Easter Egg was revenge for the earlier WAIT 6502,1 Easter Egg that Microsoft had inserted into CBM BASIC without Commodore's permission.
@Raymond68 Ah! Yeah, I forgot about that. That makes more sense.
@RossRidge someone did something similar for Java stackoverflow.com/questions/15182496/… and I followed suit to do in R jcarroll.com.au/2016/05/30/seed
It would be interesting to do that with the Mersenne Twister PRNG in the C++ standard library.

last day (15 days later) »