18
\$\begingroup\$

A half cardinal cyclic quine is a cyclic quine with two states, one perpendicular to the other.

Rules

You can decide which rotation you want to implement, clockwise or counter-clockwise.

Once rotated, any gaps in your code should be replaced with spaces to preserve the positioning.

Your program must satisfy the community definition of a quine.

This is so the shortest program in each language wins. Your first program is used for your byte count.

Standard loopholes are forbidden.

Examples

If your program is:

$_='print';eval

Then the next iteration must be either:

$
_
=
'
p
r
i
n
t
'
;
e
v
a
l

or

l
a
v
e
;
'
t
n
i
r
p
'
=
_
$

which must output the original program:

$_='print';eval

If your program is:

;$_=';
;$_=';
print

Then the next iteration must be either:

;;
''t
==n
__i
$$r
;;p

or:

p;;
r$$
i__
n==
t''
 ;;

which must output the original program:

;$_=';
;$_=';
print
\$\endgroup\$
16
  • \$\begingroup\$ Related. \$\endgroup\$ Feb 28, 2018 at 20:14
  • 1
    \$\begingroup\$ Somewhat related. \$\endgroup\$ Feb 28, 2018 at 20:17
  • 1
    \$\begingroup\$ @dylnan No, the other one doesn't ask for a mutual quine. \$\endgroup\$ Feb 28, 2018 at 20:57
  • 1
    \$\begingroup\$ Having seen the answers so far I think the real challenge would be the anticlockwise one or a quine with more than one lines (so that rotation is different from transposition or simply inserting newlines). \$\endgroup\$ Feb 28, 2018 at 21:30
  • 1
    \$\begingroup\$ You might want to require the two programs to be different. Otherwise, quines which happen to have rotational symmetry would be valid answers. \$\endgroup\$ Feb 28, 2018 at 21:41

4 Answers 4

14
\$\begingroup\$

CJam, 19 17 15 bytes

{s"_~"+N*""-}_~

Try it online! Try the rotation.

Explanation

{s"_~"+  e# Standard quine framework. Puts a string representation of the entire
         e# program on the stack.
  N*     e# Riffle linefeeds into the string, which is effectively a clockwise
         e# rotation by 90°.
  ""-    e# Does nothing.
}_~

In the rotated code, we've got linefeeds everywhere:

{
s
"
_
~
"
+
N
*
"
"
-
}
_
~

As Lynn noticed on Dom's earlier quine challenge inserting linefeeds actually still forms valid quine, because the linefeeds inside the block will just be retained verbatim anyway, and there will also be linefeeds in the "_~" string to make those two characters at the end show up on their own line. So {s"_~"+...}_~ (with linefeeds) is still a valid quine framework (although there'll be an additional linefeed at the end of the string). N* now inserts even more linefeeds into that string, but we don't really care: because now ""- has a linefeed inside that string so it actually removes all linefeeds from the program representation. So we end up with the horizontal form of the code again, undoing the rotation.

\$\endgroup\$
5
\$\begingroup\$

Stax, 28 bytes

"8H^Hs+2*A]/Mm"8H^Hs+2*A]/Mm

Run and debug the first form

Run and debug the second form

\$\endgroup\$
0
5
\$\begingroup\$

><>, 22 bytes

 "2+}>oao#ov*48}}*d3'v

Try it online!

Rotated anti-clockwise:

v
'
3
d
*
}
}
8
4
*
v
o
#
o
a
o
>
}
+
2
"

Try it online!

The first one prints the line in reverse with newlines interspersed, and the second prints it in reverse without the newlines.

\$\endgroup\$
2
  • \$\begingroup\$ This is very clever! \$\endgroup\$ Mar 1, 2018 at 1:35
  • \$\begingroup\$ Good going on approaching it on hard mode! \$\endgroup\$ Mar 1, 2018 at 2:56
4
\$\begingroup\$

05AB1E, 36 34 bytes

4"D6Ø·çýD¶åi¶KëS»"D6Ø·çýD¶åi¶KëS»

Try first iteration or Try next iteration

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.