9
\$\begingroup\$

Let's go for a rollercodester ride

The objective of this challenge is to create a program that is run recursively through several languages of your choice. The output of the first iteration becomes the code for the second iteration, et. cetera.

  • You choose the language sequence, but each unique language may be used only once. Unique languages will be determined using CGCC standards (different compiler flags => different languages!)
  • Each step must be a complete program that terminates before the next step will be executed.
  • The entire output of stdout (not including stderr) will be considered code for the next step.
  • Other than executing and producing output, your programs can do whatever they want but every byte that your program reads contributes a byte to it's scored code length.
  • Each step executes in a theoretically clean environment, no actions of prior steps can be accessed by the current step.
  • Please score your submission as best as you can, I anticipate some difficulty validating submissions (no fancy scoring tool yet...).

Scoring

Thanks to ovs for creating a score calculator: TIO Link

  • The curvature of any three consecutive steps in the submission is the difference of the difference of each step's code length.
  • Any three consecutive steps in the submission earn score points equal to their absolute curvature divided by the total source length of all three steps.
  • Each scored step will be rounded (x>=5e-7 becomes 1e-6, x<5e-7 becomes 0) to the nearest 1e-6, to make scoring exact.
  • The goal is to achieve the highest score.
  • In the unlikely event of a tie, the shortest initial (just the first step) submission in bytes wins (it's gotta have some sort of golf, right???).

To discuss scoring consistently we can call the first step "Step 1", and assign scored points to the last step that contributes to those points. The first two steps (1 and 2) are not scorable because there isn't enough data to calculate a score, then each step after that has a score calculated from itself and the two prior steps. i.e. in the working example below, step 3 scores .566038, step 4 scores .536082

Scoring example

  • Step 1 (original submission) : 50 bytes
  • Step 2: 25 bytes -25 change
  • Step 3: 50 bytes +25 change +50 curvature / 50+25+50 bytes = 0.4 score
  • Step 4: 40 bytes -10 change -35 curvature / 25+50+40 bytes = 0.304348 score
  • Step 5: 30 bytes -10 change +0 curvature / 50+40+30 bytes = 0 score

total score: (0.4+0.304348+0) = 0.704348

Working example

Here's a working example, code is below the score. I can maximize my score by increasing the repeating parts of the Octave and Python 1 code, but can never get more than a score of 2 in any step.

4 steps:

  1. Python 3 - 107
  2. Octave - 166
  3. C (gcc) - 45
  4. Python 1 - 80

scoring:

step  diff  curve  total_len score
107   -     -
166   +59   -
45    -121  -180   318       0.566038
80    +35   +156   291       0.536082

total:                       1.102120

Python 3, 107 bytes

print(f"""disp("main(){'{for(int i=0;i<10;i++)puts(""print 1"");}'}")
{'''
'''.join(['%commented']*10)}""")

Try it online!

Octave, 166 bytes

disp("main(){for(int i=0;i<10;i++)puts(""print 1"");}")
%commented
%commented
%commented
%commented
%commented
%commented
%commented
%commented
%commented
%commented

Try it online!

C (gcc), 45 bytes

main(){for(int i=0;i<10;i++)puts("print 1");}

Try it online!

Python 1, 80 bytes

print 1
print 1
print 1
print 1
print 1
print 1
print 1
print 1
print 1
print 1

Try it online!

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Here is a scoring program: TIO \$\endgroup\$
    – ovs
    Sep 21 at 8:07
9
\$\begingroup\$

9 langs, score 7.090470.

Deadfish~, 10000001377 bytes

{{i}}iic{i}dciiic{{d}iii}ddddc{iiiiii}iiiiic{dddd}ddddc{d}dddc{i}ic{iiii}iiiiiic{dddd}dddddc{d}dcdcc{i}ic{iiii}iiiiiic{dddddd}ddccddcdc{iiiiii}dc{dddd}iic{iiii}ddc{i}iicdciiiiicddddcdddc{d}iiic{ddddd}dddddc{iiiiii}iiciiic{d}iic{dddddd}ddcdcdcddddc{iiiiii}iiiic{i}iicddcc{d}iic{i}dciiiiiic{{d}ii}iiiciic{ii}ddc{iiii}c{dddddd}icdc{iiiii}iic{ii}iciic{d}iciiiiiciiiiiic{{d}iii}ddddddcddddddcic{iiiiii}iiiic{i}iicddcc{d}iic{i}dciiiiiic{{d}ii}ddc{i}dddc{d}ic{{i}ddd}c{i}dciiic{{d}ii}ddc{{i}ddd}iiic{{d}iii}dddc{{i}ddd}iiiciiiiic{{d}ii}iic{{i}dd}iic{dd}iiic{i}iiic{d}iiicddc{dddddd}dc{i}dcdccc{d}iiic{iiiii}iic{ddd}ddddc{ddd}iiic{{i}dd}ciic{d}iciiiiiciiiiiic{{d}iii}ddddddcddddddc{iiiiii}iic{ddddd}icdddddc{iiiii}iiiic{ddddd}ddc{iiiiii}iiic{dddddd}iic{d}ic{iiiii}iiiiiic{ii}iiiic{dd}ddddc{i}ic{dddddd}iic{d}iiiciicdddc{iiiii}iiiiic{ddddd}ddddciiiiic{iiiii}dc{ddddd}ddc{iiiii}iic{dddddd}dc{{i}ddd}ciiiiic{d}dc{i}dc{i}dc{dd}iiicic{{d}iii}ic{iii}ddc{iiiii}iiiiicic{d}ddddddciiiiiciiiiiic{dddddd}dddddc{iiiiii}ddc{dddd}ddc{iii}iiiic{ddddd}ddc{iiiii}iic{i}dciiiiiciiiiiic{{d}ii}ddddc{{i}dd}dddc{d}ddc{i}ddciiiiic{{d}iii}cic{{i}dd}iic{d}dciiiiicdcdc{{d}iii}dddddc{iiiii}iicc{dddddd}iic{{i}dd}ddciiiiicdcdc{{d}ii}dddciiiiic{{i}ddd}iiiiiic{dd}ddc{ddddd}iic{iiiii}ddc{ddddd}iiciiic{iiiii}dddccdcc{dddddd}iic{i}dddc{ii}ddc{iiiiii}iiiiiic{ddd}ic{ddddd}ddc{d}c{i}dddcddciiciiiiiicc{iii}iiiicccccc

Try it online!

With \$10^{10}\$ h at the end.

HQ9+, 192 bytes

for(i=0;i<100;i++)(c=console.log)('#comment');c('[print("#comment") for i in range(1000)]; print("`/*`,k1(`x`k1*,)`*/`,`#include <stdio.h>`,`int main(){puts(\\"puts %q[+[+.]]\\");}`,")')//QQQQQQ

Try it online! (code will need to be pasted in)

Note: Extraneous content has been simplified in the below snippets, and removed from the TIOs - if you add it back it'll work fine.

JavaScript (Node.js), 1164 bytes

for(i=0;i<100;i++)(c=console.log)('#comment');c('[print("#comment") for i in range(1000)]; print("`/*`,k1(`x`k1*,)`*/`,`#include <stdio.h>`,`int main(){puts(\\"puts %q[+[+.]]\\");}`,")')//QQQQQQ

Repeated 6 times.

Try it online!

Python 3, 1033 bytes

#comment 
[print("#comment") for i in range(1000)]; print("`/*`,k1(`x`k1*,)`*/`,`#include <stdio.h>`,`int main(){puts(\"puts %q[+[+.]]\");}`,")

Try it online!

The #comment is repeated 100 times.

Vyxal, 9081 bytes

#comment
`/*`,k1(`x`k1*,)`*/`,`#include <stdio.h>`,`int main(){puts("puts %q[+[+.]]");}`,

The #comment is repeated 1000 times.

Try it Online!

C (gcc), 914699 bytes

/*x*/
#include <stdio.h>
int main(){puts("puts %q[+[+.]]");}

Try it online!

The x is actually 1000 newline-separated copies of 1000 more x.

Ruby, 14 bytes

puts %q[+[+.]]

Try it online!

brainfuck, 5 bytes

+[+.]

Try it online!

PHP, 382 bytes

	

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ

Try it online!

No idea what my score is. Thanks to @ovs for calculating my score.

\$\endgroup\$
4
  • \$\begingroup\$ Your score is 6.879713 (You can actually increase your score by making the Deadfish program longer) \$\endgroup\$
    – ovs
    Sep 21 at 8:10
  • \$\begingroup\$ @ovs Thanks! I'll make it longer. \$\endgroup\$
    – emanresu A
    Sep 21 at 8:12
  • \$\begingroup\$ Add something like /// or Text or HTML after PHP and score will get increased \$\endgroup\$
    – wasif
    Sep 21 at 8:56
  • \$\begingroup\$ @wasif This was meant to be a simple demonstration, nothing more, so I think I'll leave it at that. \$\endgroup\$
    – emanresu A
    Sep 21 at 8:58
5
\$\begingroup\$

Score 20

Have I misunderstood this question? I'm not quite sure what's happening here. Please leave a comment if this is not allowed by the rules, and I will then delete it.

The basic idea is try to find out if any languages accept an empty program and output something (non-empty stdout). And this could be extended as long as you spend some more time on esolang wiki and find out more languages and append them to this chain...

\$\endgroup\$
2
  • \$\begingroup\$ I think this is a great strategy, I say max out your score and we'll see if anyone beats it \$\endgroup\$
    – M Virts
    Sep 22 at 2:18
  • 1
    \$\begingroup\$ @KevinCruijssen Sorry I mistaken replaced them when I try to format my post. Seems emanresuA had corrected it before I just noticed your comment... :) \$\endgroup\$
    – tsh
    Sep 22 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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