Easter egg

From Rosetta Code
Not A Task

Trigger or find an Easter egg and document what it does.

Commodore BASIC[edit]

MICROSOFT!

Works with: Commodore PET

If executed in Commodore BASIC V2.0, MICROSOFT! appears in the top-left, the 6502 being a reference to its CPU: <lang basic>WAIT 6502,1</lang> Credits

Works with: Commodore C16
Works with: Commodore Plus/4

The names of three programmers and a hardware designer appear: Fred Bowen, John Cooper, Terry Ryan and Bil Herd, the first in reverse-field and the last blinking on and off: <lang basic>SYS 52651</lang>

Works with: Commodore C128

The screen is cleared and a credits screen for the hardware and software designers, followed by Link arms,don't make them in reverse-field, appears: <lang basic>SYS 32800,123,45,6</lang>

Factor[edit]

This easter egg is not something to trigger, but rather something in Factor's source code. The hash code for f โ€” Factor's canonical false/nil value โ€” is 31337, as can be seen from the following definition: <lang factor>M: f hashcode* 2drop 31337 ; inline</lang> The number stems from leet speak, which originated in the computer bulletin board systems of the 80s. It later became memetic in online gaming communities during the late 90s, when Factor's creator (Slava Pestov) was a teenager.

Julia[edit]

Julia's compiler is partially written in a dialect of Lisp, and Julia's executable can be run with the --lisp flag, which runs its Lisp interpreter:

home> julia --lisp
;  _
; |_ _ _ |_ _ |  . _ _
; | (-||||_(_)|__|_)|_)
;-------------------|----------------------------------------------------------

>

Phix[edit]

Not exactly an easter egg, but (assuming you already know that 'p -cp' is how to recompile the compiler):
Running 'p p p p p p p p -cp' stacks 7 interpreted copies of itself on top of one another, with the very top/last copy actually replacing the very bottom/first one!

I also once wrote a fortune program, and somehow never added it to the distro. It will be in 0.8.3 and later:

p fortune
Output:
A project not worth doing at all is not worth doing well.

Python[edit]

A full list of Easter eggs is available here.

Quackery[edit]

Despite having a name that suggests the presence of eggs, here is not much room for Easter eggs in the very short (less than 50k) Quackery source code file; the closest to an Easter egg is that the shell (IDE) prints a randomly selected farewell message when you leave it.

Quackery does provide plenty of scope for mischievous coding. One trivial example would be renaming numbers.

Welcome to Quackery.

Enter "leave" to leave the shell.

Building extensions.

/O> 23 is 42
... 

Stack empty.

/O> 42
... 

Stack: 23 

/O> leave
... 

Toodles.

Raku[edit]

A little context first: There is a built-in auto-documentation routine in Raku: WHY. It allows documenting methods and routines inside modules using Raku POD6. The POD serves as both commenting for the routine itself and is query-able programmatically.

An example:

<lang perl6>#| Initiate a specified spell normally sub cast(Spell $s) {

   do-raw-magic($s)

}

  1. = (do not use for class 7 spells)

say &cast.WHY;</lang>

Output:
Initiate a specified spell normally
(do not use for class 7 spells)

The Easter egg:

<lang perl6>say 'Life, the Universe and Everything'.WHY</lang>

Output:
42

Also, there are two undocumented, nominal binary base conversion routines: <lang perl6>say 31527.base(2); say 31527.base('camel'); say 31527.base('beer');</lang>

Output (150% size to make it easier to see):
111101100100111
๐Ÿซ๐Ÿซ๐Ÿซ๐Ÿซ๐Ÿช๐Ÿซ๐Ÿซ๐Ÿช๐Ÿช๐Ÿซ๐Ÿช๐Ÿช๐Ÿซ๐Ÿซ๐Ÿซ
๐Ÿป๐Ÿป๐Ÿป๐Ÿป๐Ÿบ๐Ÿป๐Ÿป๐Ÿบ๐Ÿบ๐Ÿป๐Ÿบ๐Ÿบ๐Ÿป๐Ÿป๐Ÿป

Wren[edit]

To my knowledge there are no Easter Eggs hidden in the Wren source code but it is possible to add one via the mechanism of user defined modules. These can be imported into a Wren script and can contain not just classes but any executable code.

In the following example we first write a module called hello.wren containing a class called Hello whose say() method normally displays a suitable message. However, 20% of the time it will display an ASCII art drawing of an Easter Egg as well. <lang ecmascript>import "random" for Random

var Rand = Random.new()

/* modified image from https://ascii.co.uk/art/easter */ var EasterEgg = """

             .--.
           .'    ',
         .'        ',
        /\/\/\/\/\/\/\
       /\/\/\/\/\/\/\/\
      W                R
      |/\/\/\/\/\/\/\/\|
      |\/\/\/\/\/\/\/\/|
      E                N
       \/\/\/\/\/\/\/\/
        \/\/\/\/\/\/\/
         `.        .'
           `..__..'

"""

class Hello {

   static say() {
       if (Rand.int(5) == 0) {
           System.print(EasterEgg)
       }
       System.print("Hello from Wren!")
   }

}</lang>

The following script now imports this module and runs the Hello.say() method: <lang ecmascript>import "/hello" for Hello

Hello.say()</lang>

Output:

Output on those 20% of occasions when the Easter Egg is shown:

              .--.
            .'    ',
          .'        ',
         /\/\/\/\/\/\/\
        /\/\/\/\/\/\/\/\
       W                R
       |/\/\/\/\/\/\/\/\|
       |\/\/\/\/\/\/\/\/|
       E                N
        \/\/\/\/\/\/\/\/
         \/\/\/\/\/\/\/
          `.        .'
            `..__..'
Hello from Wren!