45 degree quine

-2

0

A very simple golf this time, but should be fun to do.

Challenge

Output your code, but rotated 45 (or -45) degrees. E.g:

lorem ipsum dolor sit amet

becomes

                         t
                        e
                       m
                      a

                    t
                   i
                  s

                r
               o
              l
             o
            d

          m
         u
        s
       p
      i

    m
   e
  r
 o
l

This logic follows for newlines, too:

lorem ipsum dolor sit amet consectetur adipiscing

becomes

                         t
                        e
                       m
                      a
                       g
                    t n
                   i i
                  s c
                   s
                r i
               o p
              l i
             o d
            d a

          m r
         u u
        s t
       p e
      i t
       c
    m e
   e s
  r n
 o o
l c

Of course, the difficulty is that you have to output your own code in this format.

Scoring

Find position b (the amount of bytes in your code). on the X-axis of the formula \$y=\left(\frac{b}{8}-15\right)^2-n\$ (given n is the number of newlines). The lower the score, the better. Newlines are encouraged, as they made rendering it harder. Also, -15 bonus points for doing -45 degrees, as opposed to 45. My examples were -45 degrees.

Rules

  • Standard loopholes apply.
  • No reading your own source.
  • There must be a space between one line of code and the next, if you choose to do so
  • Every line must be at least 5 characters long.
  • Newlines cannot be replaced with '\n'. Tabs should be replaced with two spaces.
  • Every line must do something; when removed, the program must not work
  • No trailing newlines (unless for an implicit return) or no-ops.
  • Blank newlines should be rendered with a space in its place (you can assume its a line of contents ' ')

Geza Kerecsenyi

Posted 2019-03-01T23:21:12.787

Reputation: 1 892

Question was closed 2019-03-02T17:25:10.440

2What does "There must be a space between one line of code and the next, if you choose to do so" mean? – dfeuer – 2019-03-01T23:23:58.287

If you take a look at my second example, the text that was originally on two lines is now on one line, separated by space. E.g you can see it goes 'L C' on the bottom row of the second example, not 'LC' – Geza Kerecsenyi – 2019-03-01T23:28:00.483

2Also, the scoring system seems to mean that there's no point to having code under 120 bytes? – Jo King – 2019-03-02T01:28:00.277

I am sad that the second line is two columns right instead of one right and one down. – Sparr – 2019-03-02T02:40:00.680

May we print anything to STDERR? – Embodiment of Ignorance – 2019-03-02T02:42:59.533

3How does the scoring work? I feel like I did it wrong, I hv=ave the smallest byte count, but the highest score? My program fits all of the rules too! I feel like I'm missing something here... – KrystosTheOverlord – 2019-03-02T03:48:51.807

4Just FYI, this isn't code-golf anymore, it's code-challenge, since the criterion isn't strictly lowest byte count. – Rɪᴋᴇʀ – 2019-03-02T04:32:53.173

2I think what @dfeuer meant was whether the space between characters was optional or not, since you specify the conflicting statements There must be a space and if you choose to do so – Jo King – 2019-03-02T11:15:18.867

@JoKing If you choose to have newlines in your code – Geza Kerecsenyi – 2019-03-02T13:32:51.637

How do trailing newlines get rotated? Do I need to add any characters for them? – Post Rock Garf Hunter – 2019-03-02T15:52:15.237

@SriotchilismO'Zaic There can't be trailing newlines, since each line must have at least 5 chars – Embodiment of Ignorance – 2019-03-02T21:11:29.887

1What do you mean by Every line must do something; when removed, the program must not work? For example, my Perl 6 solution still runs when one of my padded lines is removed but it doesn't produce the correct output anymore. Similarly, most one-line solutions will still run when the newlines are removed, and they do produce the correct output (nothing). Do you mean to invalidate my solution or the other solutions? – Jo King – 2019-03-03T04:16:39.783

1Are we allowed trailing spaces? Can we see an example of quines rotated 45 degrees, rather than -45. Especially multi-line please – Jo King – 2019-03-03T04:46:57.240

Answers

2

Gol><>, 120 bytes, score 0

sP#|oao|o `FLFl                                                                                                        "

Adding a ton of no-ops makes my score really low, so I'm just going to go with it even though it hurts my heart to see so many no-ops doing absolutely nothing :(

Try it online!

golfed answer, 16 bytes, Score : 152?!

sP#|oao|o `FLFl"

Wow, that is much smaller and more correct than my previous answer!!! (my other ones were backwards!)

Try it online!

KrystosTheOverlord

Posted 2019-03-01T23:21:12.787

Reputation: 681

try adding no-ops till your byte count is 120, you'll have a score of 0 – Embodiment of Ignorance – 2019-03-02T04:01:48.263

You can get a negative score if you combined no-ops with new lines – Embodiment of Ignorance – 2019-03-02T04:09:37.833

@EmbodimentofIgnorance So basically if I am patient enough, and have enough time to waste, I can get an ridiculously low score?! – KrystosTheOverlord – 2019-03-02T04:11:52.090

That is exactly what I'm saying, and why the current scoring system is broken. – Embodiment of Ignorance – 2019-03-02T04:12:33.550

2@EmbodimentofIgnorance I feel like the scoring should just be based off of bytes, and perhaps penalties for trailing newlines, rather than this weird equation – KrystosTheOverlord – 2019-03-02T04:15:37.167

1

C# (Visual C# Interactive Compiler), Score 50.765625

var s="var s={0}{1}{0};for(int i=0;;)WriteLine(new String(' ',i)+string.Format(s,(char)34,s)[i++]);";for(int i=0;;)WriteLine(new String(' ',i)+string.Format(s,(char)34,s)[i++]);

Try it online!

Also prints to STDERR, if this is invalid I will change it.

Embodiment of Ignorance

Posted 2019-03-01T23:21:12.787

Reputation: 7 014

1

Japt -S, 25 bytes, Score: 116

25Çî iRiZgQi"25Çî iRiZgQi

Run it online

Oliver

Posted 2019-03-01T23:21:12.787

Reputation: 7 160

1

Perl 6, Score -14

<+map
{say(
~($_,)
.indent(
$++))
},[Z]
"<$_>[]~~
.EVAL#1234567"
.words
.map:{
.fmt(
"%-14s"
).comb
}>[]~~
.EVAL#1234567

Try it online!

New solution since my old one (below) might (?) be invalidated by the new rules. The output looks like:

< { ~ . $ } " . . . . " ) } .
 + s ( i + , < E w m f % . > E
  m a $ n + [ $ V o a m - c [ V
   a y _ d ) Z _ A r p t 1 o ] A
    p ( , e ) ] > L d : ( 4 m ~ L
         ) n     [ # s {   s b ~ #
            t     ] 1       "     1
             (     ~ 2             2
                    ~ 3             3
                       4             4
                        5             5
                         6             6
                          7             7
                           "              

I'm not sure if this is valid output since there's no example of a normal 45 degree quine in the question itself (this one is mirrored as well as rotated).

Perl 6, Score: -8

<+map {say .indent($++),' 'x($++ <5)*16},"<$_>~~.EVAL".comb#123>>~~.EVAL
     
     
     
     
     
     
     
     

Try it online!

Pads the code by 8 lines of 5 space characters, and then adds trailing spaces to the first 5 lines.

Jo King

Posted 2019-03-01T23:21:12.787

Reputation: 38 234

Doesn't this break the rule Every line must be at least 5 characters long? – Emigna – 2019-03-02T09:30:18.030

@Emigna Ah, missed that. Fixed – Jo King – 2019-03-02T11:00:19.387

Nice! If this program is -14 bytes, I can just download it over and over again! Free storage! – Redwolf Programs – 2019-03-03T04:50:23.657

@Redwolf This isn't [tag:code-golf], the score is from a (rather bad) formula which goes negative with enough newlines – Jo King – 2019-03-03T05:42:28.827

0

Charcoal, 40 bytes, score 100

≔´α´↗´´´≔´F´α´↗´⁺´´´´´ι´↗´αα↗´≔Fα↗⁺´´ι↗α

Try it online!

Based off the standard Charcoal quine

ASCII-only

Posted 2019-03-01T23:21:12.787

Reputation: 4 687

37 bytes: ≔´α´↶´¹´´´≔´F´α´⁺´´´´´ι´αα↶¹´≔Fα⁺´´ια – Neil – 2019-03-02T11:13:12.267

@Neil Technically, you're just making the score worse :o – Jo King – 2019-03-02T11:16:25.557

The reason for this is that making really short quines isn't really much of a challenge any more, so instead the longer it is the higher the score (for a little while) – Geza Kerecsenyi – 2019-03-02T19:52:34.520

@GezaKerecsenyi Yeah that's not going to work... basically every single quine under our definition is payload-capable so they can be lengthened arbitrarily – ASCII-only – 2019-03-02T22:32:48.907

Couldn't you add no-ops to make your score smaller (like spaces)? – MilkyWay90 – 2019-03-03T04:28:03.750