tkellehe / noodel

A programming language designed around supporting ASCII animation based code golfing challenges.
10 stars 0 forks source link

Quote-Safe Quines #95

Open tkellehe opened 7 years ago

tkellehe commented 7 years ago

http://codegolf.stackexchange.com/questions/108331/quote-safe-quines

9 bytes

Ḷ1ḥ-Ð1ḥ@€
Ḷ1        # Loops the following code once.
   ḥ-     # Grabs the literal string of the token preceding this token which produces the string "Ḷ" and pushes to the top of the stack.
    Ð     # Pushes the stack (which is an array) to the screen and since it is done by reference, as the stack changes so will what is printed.
     1    # Pushes the literal string "1". This is done because "Ḷ" needs to be "Ḷ1". So, what is printed currently is "Ḷ1".
      ḥ@  # Pushes the literal string "ḥ-Ð1ḥ@€" (essentially this command gets the string of the code based off of the containing scope it is in).
        € # Ends the loop. (currently the stack looks like [ "Ḷ", "1", "ḥ-Ð1ḥ@€"].
          # Top of the stack gets popped off and placed to the screen (which removes it from the array because it is the stack)

My answer

Try it:)

tkellehe commented 7 years ago

7 bytes

Forgot Noodel had a way to loop a given block of code once...

ḷḥ-Ðḥ@ḅ

Try it:)

tkellehe commented 7 years ago

3 bytes

Got a little more clever.

ḥɲ`
ḥ   # Pushes on the string literal "ḥɲ`" onto the stack.
 ɲ` # Ends the program immediately.
    # Implicitly pop off of the top of the stack.

Try it:)