304
\$\begingroup\$

This is an challenge in which each answer builds on the previous answer. I recommend sorting the thread by "oldest" in order to be sure about the order in which the posts are made.

Note: This has become quite a long-lasting challenge, and posting new answers is fairly difficult. As such, there's now a chat room available for this challenge, in case you want advice on a particular part of a potential answer, have ideas for languages that could be added, or the like. Feel free to drop in if you have anything to ask or say!

The task

The nth program to be submitted must run in n different languages; specifically, all the languages added in previous programs to be submitted, plus one more. The program must output 1 when run in the first language used in answers to this question, 2 when run in the second language, and so on. For example, the first answer could print 1 when run in Python 3, and the second answer could output 1 when run in Python 3 and 2 when run in JavaScript; in this case, the third answer would have to output 1 when run in Python 3, 2 when run in JavaScript, and 3 when run in some other language.

Additional rules

  • Your program must run without erroring out or crashing. Warnings (and other stderr output) are acceptable, but the program must exit normally (e.g. by running off the end of the program, or via a command such as exit that performs normal program termination).

  • The output must be only the integer, but trailing newlines are OK. Other unavoidable stdout output is also allowed. Examples: interpreter name and version in Befunge-93, space after printed string in Zephyr. Some languages provide two methods of printing – with and without trailing space; in this case method without trailing space must be used.

  • Each answer must be no more than 20% or 20 bytes (whichever is larger) longer than the previous answer. (This is to prevent the use of languages like Lenguage spamming up the thread, and to encourage at least a minor amount of golfing.)

  • Using different versions of the same language is allowed (although obviously they'll have to print different numbers, so you'll need to fit a version check into the polyglot). However, you may not use a language feature that returns the language's version number. Repeating the exact same language is, obviously, impossible (as the program would have to deterministically print one of two different numbers).

  • Tricks like excessive comment abuse, despite being banned in some polyglot competitions, are just fine here.

  • You don't have to use the previous answers as a guide to writing your own (you can rewrite the whole program if you like, as long as it complies with the spec); however, basing your answer mostly on a previous answer is allowed and probably the easiest way to make a solution.

  • You cannot submit two answers in a row. Let someone else post in between. This rule applies until victory condition is met.

  • As this challenge requires other competitors to post in the same languages you are, you can only use languages with a free implementation (much as though this were a contest).

  • In the case where a language has more than one interpreter, you can pick any interpreter for any given language so long as all programs which are meant to run successfully in that language do so in that interpreter. (In other words, if a program works in more than one interpreter, future posts can pick either of those interpreters, rather than a post "locking in" a particular choice of interpreter for a language.)

  • If some interpreter gets updated and the program no longer works in the newer version then new answers can either stick to the old version or fix the program to work in the new version.

  • This challenge now uses the new PPCG rules about language choice: you can use a language, or a language interpreter, even if it's newer than the question. However, you may not use a language/interpreter that's newer than the question if a) the language was designed for the purpose of polyglotting or b) the language was inspired by this question. (So newly designed practical programming languages are almost certainly going to be OK, as are unrelated esolangs, but things like A Pear Tree, which was inspired by this question, are banned.) Note that this doesn't change the validity of languages designed for polyglotting that are older than this question.

  • Note that the victory condition (see below) is designed so that breaking the chain (i.e. making it impossible for anyone else to answer after you via the use of a language that is hard to polyglot with further languages) will disqualify you from winning. The aim is to keep going as long as we can, and if you want to win, you'll have to respect that.

Answer format

As all the answers depend on each other, having a consistent answer format is going to be helpful. I recommend formatting your answer something like this (this is an example for the second link in the chain):

2. JavaScript, 40 bytes

(program goes here)

This program prints 1 in Python 3, and 2 in JavaScript.

(if you want to explain the program, the polyglotting techniques, etc., place them here)

Victory condition

Once there have been no new answers for 14 days, the winner will be whoever posted the second newest answer, i.e. the largest polyglot that's been proven not to have broken the chain. Extending the chain after that is still very welcome, though!

The winner is Chance, see answer 194 (TemplAt).

Language list

// This snippet is based on the snippet from hello world thread https://codegolf.stackexchange.com/questions/55422/hello-world
// It was tested only in Google Chrome

// https://stackoverflow.com/a/4673436
if (!String.prototype.format) {
  String.prototype.format = function() {
    var args = arguments;
    return this.replace(/{(\d+)}/g, (match, number) => (typeof args[number] != 'undefined' ? args[number] : match) );
  };
}

var QUESTION_ID = 102370; // from the question url
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

var answers = [], answer_page = 1;

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      if (data.has_more) { $('#status').text($('#status').text() + '.'); getAnswers(); }
      else process();
    },
    // [Documentation](http://api.jquery.com/jquery.ajax/) states that `error` handler is not called for cross-domain JSONP requests, 
    // but it works here, probably because api.stackexchange.com and codegolf.stackexchange.com are on the same domain.
    error:  function (a,b,c) { 
      $('#status').text( "Failed to load answers: " + b + " " + c );
      console.log( b + " " + c );
    },
  });
}

getAnswers();

// https://stackoverflow.com/questions/6290442/html-input-type-text-onchange-event-not-working/39834997#39834997
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event
const input = document.querySelector('input');
input.addEventListener('input', onSearchInput);

function onSearchInput(e)
{
    var table = document.getElementsByTagName("table")[0];
    var str = e.srcElement.value.toLowerCase();
    var num_results = 0;

    if(str == "") // optimization for empty input
    {
        // show all rows
        for(var i = 1, row; row = table.rows[i]; i++)
        {
            row.className = "";
            num_results++;
        }
    }
    else
    {
        for(var i = 1, row; row = table.rows[i]; i++)
        {
            var hidden = row.innerText.toLowerCase().indexOf(str) == -1;
            if(!hidden) num_results++;
            row.className = hidden ? "hidden" : "";
        }
    }
    document.getElementById("results").innerText = "Results: " + num_results;
}


/* Function ParseHeader() extracts answer number, language name and size of polyglot from answer header.
   Argument: `header` - answer header string without markup, eg. "1. Python 3 (8 bytes)" or "59. Tcl, 1324 bytes".
   Retval:  object, eg. {num: 1, language: "Python 3", size: 8} or 
            null if header has wrong format
  
   There are two formats of header, new one with comma and old one with parens.
   Parsing new format only with regexp is hard because:
   - language name may contain commas,                                 eg. "51. Assembly (x64, Linux, AS), 1086 bytes"
   - there may be several sizes, of which the last one should be used, eg. "210. Haskell without MonomorphismRestriction, 10035 9977 bytes"

   There are only several answers with old format header: 1-5, 7, 12-17, 21. All of them have single size and don't have parens in language name,
   so they can be parsed with simple regexp.
   
   Algorithm: Find commas. If there are no commas parse it as old format. Otherwise parse it as new format.
   New format parsing: Let everything after last comma be `sizes`. Check if `sizes` ends with the word "bytes". If not, set size to 0.
   Take the word before "bytes" and convert it to number. Parse the rest of the header (before last comma) with regexp.
*/
function ParseHeader(header)
{
  var a = header.split(',');
  if(a.length > 1) // current format: Number "." Language "," Size+ "bytes"
  {
    // filter(s=>s) removes empty strings from array (handle multiple consecutive spaces)
    var sizes = a[a.length-1].split(" ").filter(s=>s); // " 123 100  bytes " -> ["123", "100", "bytes"]
    var size;
    if(sizes.length < 2 || sizes[sizes.length-1] != "bytes") size = 0;
    else size = +sizes[sizes.length-2];

    a.splice(a.length-1,1); // remove last element
    var match = a.join(',').match(/(\d*)\.(.*)/);
    if (!match) return null;
    return{
            num: +match[1],
            language: match[2].trim(),
            size: size,
          };
  }
  else // old format: Number "." Language "(" Size "bytes" ")"
  {
    var format = /(\d*)\.([^(]*)\((\d*)\s*bytes\)/;
    var match = header.match(format);
    if (!match) return null;
    return{
            num: +match[1],
            language: match[2].trim(),
            size: +match[3]
          };
  }
}

// 1533246057 (number of seconds since UTC 00:00 1 Jan 1970) -> "Aug 2 '18"
// other useful Date functions: toUTCString, getUTCDate, getUTCMonth, getUTCFullYear
function FormatDate(n)
{
  var date = new Date(n*1000); // takes milliseconds
  var md = date.toLocaleDateString("en-US", {timeZone:"UTC", day:"numeric", month:"short"});
  var y  = date.toLocaleDateString("en-US", {timeZone:"UTC", year:"2-digit"});
  return md + " '" + y;
}


var processed = []; // processed answers, it's called `valid` in original snippet

function ProcessAnswer(a)
{
  var body = a.body, header;

  //
  // Extract header from answer body.
  // Try find <h1> header (markdown #). If not found try find <h2> (markdown ##).
  // Extracted header contains only text, all markup is stripped.
  // For 99 language markup is later readded to language name because markup is essential for it.
  //
  var el = document.createElement('html'); // dummy element used for finding header
  el.innerHTML = body;
  var headers = el.getElementsByTagName('h1');
  if(headers.length != 0) header = headers[0].innerText;
  else {
    headers = el.getElementsByTagName('h2');
    if(headers.length != 0) header = headers[0].innerText;
    else { console.log(body); return; } // error: <h1> and <h2> not found
  }

  var info = ParseHeader(header)
  if(!info) { console.log(body); return; } // error: unrecognised header format

  if(info.num == 99 && info.language == "99") info.language = "<i>99</i>";

  processed.push({
    num:         info.num,
    language:    info.language,
    size:        info.size,
    answer_link:   a.share_link,
    user:          a.owner.display_name,
    user_link:     a.owner.link,         // `undefined` if user was deleted
    creation_date: a.creation_date,      // unix epoch (number of seconds since UTC 00:00 1 Jan 1970)
  });
}

function process()
{
  $('#status').remove();

  answers.forEach(ProcessAnswer); // answers -> processed
  
  processed.sort( (a,b)=>(a.num-b.num) ); // sort by answer number, ascending

  processed.forEach(function (a) {
    
    var date = FormatDate(a.creation_date);

    var user = a.user_link ? ('<a href="'+a.user_link+'">'+a.user+'</a>') : a.user; // redundant code, currently the only deleted user is ais523
    if(user == "user62131") user = '<a href="https://chat.stackexchange.com/users/246227/ais523">ais523</a>';

    var style = (a.num == 194) ? "background: #ccf" : ""; // 194 is winner answer

    var row = "<tr style='{0}'><td>{1}</td> <td><a href='{2}'>{3}</a></td> <td>{4}</td> <td>{5}</td> <td>{6}</td></tr>"
              .format(style, a.num, a.answer_link, a.language, a.size, user, date);

    $('#answers').append( row );
  });
}
a {text-decoration:none}
a:visited {color:#00e}

table, td, th { border: 1px solid black; }
td, th { padding-left: 5px; padding-right: 5px; white-space: nowrap; }
tr:hover { background-color: #ff9; }
td:first-child  { text-align:center; } /* # */
td:nth-child(4) { font-style:italic; } /* author */
td:nth-child(5) { text-align:right;  } /* date */

p { margin: 8px 0px }
.hidden { display: none } /* search hides rows */
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>
  <span>Search: </span><input autofocus> &nbsp;<span id="results"></span>
</p>
<table class="answer-list">
  <thead>
    <tr><th>#</th> <th>Language</th> <th>Size (bytes)</th> <th>Author</th> <th>Date</th></tr>
  </thead>
  <tbody id="answers">
  
  </tbody>
</table>
<div id="status">Loading answers...</div>

\$\endgroup\$
28
  • 4
    \$\begingroup\$ For people who can see deleted posts: the Sandbox post was here. \$\endgroup\$
    – user62131
    Commented Dec 6, 2016 at 19:00
  • 6
    \$\begingroup\$ There's no need to copy the previous program, although of course you can use it as a guide; redoing the program from scratch is likely to take longer! There's no need to permalink to answers; sorting by oldest will show all the answers in order already. \$\endgroup\$
    – user62131
    Commented Dec 6, 2016 at 19:44
  • 4
    \$\begingroup\$ @ais523 I think what was meant was that should new answers contain try it links with the new code? \$\endgroup\$
    – Blue
    Commented Dec 6, 2016 at 19:45
  • 7
    \$\begingroup\$ I think we need a script that takes a hex dump of the code and automatically runs it in all the languages... \$\endgroup\$
    – mbomb007
    Commented Dec 7, 2016 at 20:05
  • 5
    \$\begingroup\$ This is the Versatile integer printer posted as a different type of challenge. (Inspiration?) The final answer (currently) would score 0.0127, only beaten by Sp3000's 30 language submission... :) \$\endgroup\$ Commented Dec 17, 2016 at 12:11

451 Answers 451

1
2
3 4 5
16
16
\$\begingroup\$

67. C11, 1674 bytes

#16  "(}o+?23!@)-("//*\Dv;'[af2.q]PkPPX'#CO)"14";n4
#/*0|7//```"`   [-'v][!(>77*,;68*,@;'1,@10␉␉11)(22)S␉␉(1 P''53'S^'q
#>␉
# 36!@␉`
#
#_>++++.>.+?+++++::@
#`<`
#<]}} +<[<.>>-]>[
#{
#z}
#
#=x<R+++++[D>+++++++59xL+++<-][pPLEASE,2<-#2DO,2SUB#1<-#52DO,2SUB#2<-#32DOREADOUT,2PLEASEGIVEUPFACiiipsddsdoh]>@@+.---@.>][
#
#x4O6O@
#x%+>+=ttt Z_*.
#D>xU/-<+++L
#R+.----\).>]|
#[#[(?2?20l0v0x1k1kMoOMoOMoOMoOMOO0l0ix0jor0h0h1d111x0eU0yx0y0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k1x0vx0v0l111111^_00)
[ "]56p26q[puts 59][exit]" ,'\[' ];#/s\\/;print"24";exit}}__DATA__/
#
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.
#
'((( p\';a=a;case $argv[1]+${a:u} in *1*)echo 50;;*A )echo 54;;*)echo 58;;esac;exit;';print((eval("1\x2f2")and 9or 13)-(0and 4)^1<<(65)>>62)or"'x"or' {}{}{}{}({}<(((((()()())){}{})){}{})>){(<{}(({}){})>)}{}({}())wWWWwWWWWwvwWWwWWWwvwWWWwWWWWWWWWwWWWWwWWWWWWWwWWWWWWWW li ha '#}#( prin 45)(bye)46(8+9+9+9+9+=!)((("'3)3)3)"'
__DATA__=1#"'x"
#.;R"12"'
###;console.log 39
""""
=begin
<>{nd
#sseeeemPaeueewuuweeeeeeeeeeCis:ajjap*///;.int 2298589328,898451655,12,178790,1018168591,84934449,12597/*
#define u8 "38\0"
#define p sizeof'p'-1?u8"67":"37"
#include<stdio.h>
main ( ){puts( p);}/*
print 61
#}
disp 49;
#{
}<>
$'main'3
#-3o4o#$$$
#<T>"3"O.s
=end
"""#"
#}
#sx|o51~nJ;#:p'34'3\=#print(17)#>27.say#]#print (47)#]#echo 21# xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi ax fwwvwWWWwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwvwWWwwwwwwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwvm 
# sss8␛dggi2␛`|$// ''25  16*///~-<~-<~-<<<~-XCOprint("65")#s^_^_2229996#

VIP score (Versatile Integer Printer): .005565 (to improve, next entry should be no more than 1749 bytes)

Try it online!

Numbers

This program prints 1 in Python 3, 2 in V/Vim, 3 in Minkolang, 4 in ><>, 5 in Python 2, 6 in SMBF, 7 in Japt, 8 in Retina, 9 in Perl 5, 10 in Befunge-93, 11 in Befunge-98, 12 in Fission, 13 in Ruby, 14 in Turtlèd, 15 in Haystack, 16 in Pyth, 17 in Julia, 18 in Cardinal, 19 in Reng, 20 in Prelude, 21 in Nim, 22 in Underload, 23 in Hexagony, 24 in Thutu, 25 in Pip, 26 in 05AB1E, 27 in Perl 6, 28 in Brain-Flak, 29 in Trigger, 30 in Whitespace, 31 in Modular SNUSP, 32 in Whirl, 33 in Incident, 34 in Rail, 35 in INTERCAL, 36 in Labyrinth, 37 in C++, 38 in C99, 39 in CoffeeScript, 40 in Minimal-2D, 41 in brainfuck, 42 in evil, 43 in reticular, 44 in alphuck, 45 in PicoLisp, 46 in Cubix, 47 in Lily, 48 in Deadfish~, 49 in Octave, 50 in Bash, 51 in Assembly, 52 in COW, 53 in Shove, 54 in Zsh, 55 in Brain-Flak Classic, 56 in dc, 57 in Wise, 58 in Ksh, 59 in Tcl, 60 in Moorhens, 61 in S.I.L.O.S, 62 in Grass, 63 in Brian & Chuck, 64 in Agony, 65 in ALGOL 68, 66 in Surface, 67 in C11

Verification

Most languages can be tested with the test driver above, but 6 languages have to be tested manually:

  • Reng (#19) online.

  • Modular SNUSP (#31) online.

  • Incident (#33) local.

  • Deadfish~ (#48) local. Run like this: deadfish.py < polyglot. Prints a bunch of >> lines, but that's an unavoidable consequence of running any Deadfish~ program, so it's okay.

  • Moorhens (#60) local. Note that moorhens.py from master branch doesn't work.

  • Surface (#66) local.

Explanation

Adding C11

I am using the trick with utf-8 literals (introduced in C11).

#define u8 "C99\0"
puts(u8"C11");

This trick can also be used to distinguish C++11 from C++03.

Cubix and Retina broke as a result.

Cubix

Cube size 16 -> 17. Moved 4O6O@ further in file, it ended up on line 13 (#x%+>+=ttt Z_*.), which broke fission, cardinal and minimal-2d. So I placed 4O6O@ on a separate line instead and padded it with #x.

Retina

I ended up adding 2 lines (#define u8 "38\0" and #x4O6O@), so total line count remained odd, which is good for retina. But retina still didn't work. So I moved empty line around to fix it (line 20 in answer 66). This empty line ended up before #x4O6O@. Thutu broke, so I added # to that line.

Surface

Surface still prints NULL character before 66, I didn't fix it. (It is fixed in the next answer.)

\$\endgroup\$
4
  • \$\begingroup\$ Given that #38’s C has so far been tested with bash run-wrapper.sh gcc -o polyglot polyglot.blah.c, I would prefer to define #38 as the C11 answer, and #67 as the C99 answer, but that is trivial. Nice Addition! \$\endgroup\$
    – Chance
    Commented Jun 5, 2017 at 15:56
  • \$\begingroup\$ I thought surface printed a null character, but when I run it on my machine I don't seem to get it in my output. How are you running surface? \$\endgroup\$
    – Wheat Wizard
    Commented Jun 5, 2017 at 16:28
  • \$\begingroup\$ @WheatWizard I run surface.exe on my Windows 7 32-bit machine. In console window I see blank space before 66 (NULL char is displayed exactly like a space char). If I redirect output to a file I can see it in hex viewer: ...0D 0D 0A 00 36 36 │ 0D 0D 0A 0D 0D... (newlines and other text are added by interpreter). Also, python program print("\x00\x01") produces exactly the same output (minus newlines and interpreter text) as surface program .+.@ - a blank space followed by a smiley face (char \1). \$\endgroup\$
    – stasoid
    Commented Jun 5, 2017 at 19:15
  • \$\begingroup\$ @stasoid Hm, I'll investigate perhaps it is a difference between running on windows and using Wine. I may have also made a mistake. I did run it through a hex editor but I might have missed it. \$\endgroup\$
    – Wheat Wizard
    Commented Jun 5, 2017 at 19:39
15
\$\begingroup\$

14. Turtlèd (135 bytes)

#v;2^0;7||"<+0+0+0+<*!2'!1'L#'1r'4;n4
#v0#_q@
#>3N.
#|\w*
#8  ^1b0<
#|
#M`
print ((0 and'13')or(None and 9 or 1/2 and 1 or 5))
#jd5ki2

This prints 1 in Python 3, 2 in Vim, 3 in Minkolang, 4 in <><, 5 in Python 2, 6 in SMBF, 7 in Japt, 8 in Retina, 9 in Perl, 10 in Befunge, 11 in Befunge-98, 12 in Fission, 13 in Ruby and 14 in Turtlèd.

First line added #'1r'4 near the end of line, Turtled takes #[string]# as string input then 'X places the value of x on the grid, r moves right 1 space on the grid. The value on the grid is printed at the end of the program implicitly.

Try it Online

Link to Turtled docs

\$\endgroup\$
4
  • \$\begingroup\$ @Sp3000 - edited and fixed (should be) \$\endgroup\$ Commented Dec 7, 2016 at 9:34
  • \$\begingroup\$ @L3viathan - This link should work - it contains the missing ESC literal from the last line \$\endgroup\$ Commented Dec 7, 2016 at 9:48
  • \$\begingroup\$ hooray! My language is used. Also it has a capital t, unlike brainfuck \$\endgroup\$ Commented Dec 8, 2016 at 5:26
  • \$\begingroup\$ @DestructibleWatermelon It's a fun little language for some challenges :) I saw you post a while back and thought I'd pick it up just in case. \$\endgroup\$ Commented Dec 8, 2016 at 8:42
15
\$\begingroup\$

7. Japt (50 bytes)

#v;7||"<++++<;n4
#>3N.
print('1'if 1/2else'5')
#i2

Man, it was fun to fit Japt in there. Hopefully it didn't kill anyone's plans...

Test it online!

This program prints 1 in Python 3, 2 in V, 3 in Minkolang v0.15, 4 in ><>, 5 in Python 2, 6 in SMBF and 7 in Japt

How this works: #v; takes the char code of v, or 118. Then 7|| returns the logical OR of 7 and the rest of the code, which is wrapped in a string with " to avoid any syntax errors. The result, 7, is automatically sent to STDOUT.

For future polyglotters, " can be changed to ` at no penalty to the Japt program (though I'm not sure about the others).

\$\endgroup\$
1
  • \$\begingroup\$ More on Japt is in answer 58. \$\endgroup\$
    – stasoid
    Commented Jan 26, 2020 at 13:18
15
\$\begingroup\$

300. ↑110010000100110110010, 14244 bytes

# 6 "($?63_lv+'50;+'51;5 5 %$\--$[250=@$]aat\" a/4*DvehfbIg/\"" 3 4//*26qkp16*^[.qx]"[8=,k]Pk PPX~_~)"xvy"\( 7# CO|"14" #:7 9 7 9                      7 222222222222222222222222                           "'" #\\
# 1"7"//['][']     ````      [>.>.?]~~)[7aatxy\#184  O@              (22)Siii/ \psddpsdoh ]##### #######++(- #### ##-[###### mxf ####xAegguEay######i#u####Ft#######MZWWW####WWWWWW zR###### # ####  #######:_a5# 202ø!},{P_<Ám/e!<ÁmOe!<É}M<ÁmS15%!!%BB44,222%!!%BBPZPYAAA4D,5P[5?4-0!<½!!22<2/!]ss1]'[kkX"204".â'_PPQss 7 999993 1 7 3 1 8 1 1 55 k zzzzkf kf k zzzzzd kf k zzzzza kf bfz 2#z#111#y#y#y#_# coding=utf8             ! 1>?7ДOq#t#>2/Wr#t#t#q#68#r#t#t#68#q#63#r#t#t#6v#>#</Wr#6}#y/===Wr#7ЯOq#>J7Д/Wr#y<Wr#>5/Wr#t#t#6y#>-=/Wr#6|#>6/Wr122! 1退                                @[[[["472"?]]]]******<
# if-0//               18&1&  nthteo nthieo nthneo  a;net R[+++].----._     /112\    ##### #######   # #    #####; #   #   #    ##### ####  ###   #### # W#W#####WW#WWWW#####W####WW###WWW####W#WW#W#####WW#WWWW#WWWWWWWWWWWWWWWWWWWW;WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWR
#6!@eD>>if 2>2*>++++++!\::   _@_/ 78"oo@"   '\"' ` L       >"082",,,@_ 1   x-----x########    ## ### ###### ######## #### ##### ####### ##### ###    # # #### ### ##### ####### ##### ###    # # #### ### ##### #EEEEEδΘΔΔΔΘΔΘλ
# endif/*      v>>>>>>> >>">r"{\>>>> @ 0:8:8/_ }\(*[>]R 10G|'53'S 1  >>>>  \)      # ##########>>###>## #####>>##>####>##>#>#####>>##>#####>####>>>#####>##>#>##>>##>####>>##>#####>####>>>##### ## # ##  ## ####
#comment -[v]  >>>>>>>>                    [@,,,"279"]>252O>"01",,@_ 9 h$s o#      #????!?!??!??!!!!??   ?!?!??!!?!?!!!!!?!!!!?????!????????????????????! >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>             
#[[/]e] x  > >>>>>>>@!:!8:6:2/_  >>>>>>>>>>>>>>>>>>>>>>>>>;>>>>>>>>>>>>>>>>>>      #v           @.7.8.2<
#~[! R++++++] +++++++++\++++++++++++++++++++++++++++++++++U.._+++++++._+++o+++o--ox#
####################################################################################>
 #{{{{]~*[~* __+++++++[>+++++++<-]>+._+++++._+._@]+-}}[.^+;;+;;+;;+<>;;+;;+;;+;;;;;;+;;+;;.._]}--<^>++[+++++[>+++++++<-]>._++++._+++._^<]+-+<[<=oC<=oC<._>>>>-]^>[<+++++[>++++++++++<-]>@@+.---@._+>$] '4o'6o@)++$--![+++[>+++++++<-]>+._+++++.._>](  <<>> }<}>}[<}}<<}<<<<<}<<}<<<<}<<<}}}<}}<}}<}}<}}<}}<}}}<}}<<<<<<<<<<<}}}<}}<}}<}}<}}<}}<}}}<<<<<<<<<<}]  >>\[/>\/\>>>>>>>]>\[./>>\/\./\/>>>\./]  [[[
#-  x
#* *#p 173#*  e:1*23/5x%6E2  []-main=-[165]- ###  `. :-write(186). end_of_file. `
#`⟪`⟪\⟫9999 9 9
#/*9 999 99 9999 Mn MMM MMMMnnMnnnMnMMMMMMMnMMnnnnnMMnMnMnnMnMnnnnnnMnMnMMMMMMMMnnMnMnnnMnMMMM    @,,,"286"_+1y2 #<"67",,@␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋'''␌`297'print quit`s'''␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␌␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋
#|9  
#cs 9 9999
#   
#<<<#
#>  
#{  
#bqbqbqLzLzLzqtqtqtTcTcTcRqRqRq TzTzTzRtRtRtMbMbMbPsPsPsTqTqTqAbAbAbTmTmTmBqBqBqMtMtMtUgUgUg
#=($?$?0l0c01k1k0l0i 0r 0h0h1d111 0e 0y0y 0mo1d0y0e0e001d0i0f 0g 0n0n110mo0n0t 0t0mo0f0t0g0g0f0h0r0r0i0001k10c 0c0l11110000011100|_  )\
[ ' "`e```.1.0.6i]56pq["]298 .quit._[`\']put 294 bye!\` #s['];#/\\/;print 24;exit}}__END__/
###\MoOMoOMoOMoOMOOmoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOomoomoOOOM e>+@+-@@@@=>+<@@@=>+<?#>;?\:-._++._++++._#/<?\>3-++._6+---2._#/++++++++++++++++++++++++++++++++++++++++++++++++._++._++++++.>!\
' WWWw;WW;WW;wv;w;;WW;wW;WW;wv;wW;W_;Ww;WW;WW;WW;WW;wW;WW;Ww;W;WW;WWWWwW;;;WWWWWWWwwwwvwWWWwWWWWwvwWWwW\WWwvwWWwWWWwvwW/Ww\WWW ho ho ho ho // ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi MU ([])  ({}<(((((()()())){}{})){}{})>)(({})){}{(<(<()>)({})({}<{}>({}){})>){({}[()])}}({}){}({}()<()()()>)  (<><()>){({}[()])}{  #(((()()()()())()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()())(()()()))  ((((((((\';  a=$(printf \\x00);b=$(echo -n $a|wc -c);case $b[1]¢ in 1?)echo 54;;1* )echo 242;;4* )echo 78;;8* )echo $((9999999999999999999>0?166:244));;0?1??)echo 50;;0* )echo 282;;* )echo 58;;esac;exit;#{IO.puts 295#)';  print (0and eval('":"&&(defined?A)&&290||(defined?pp)&&190||(defined?__dir__)&&13||"_"[0]==95&&108||110')or(None and(-1 %2>0and 9or 247)or 1/2and eval('hasattr(zip,"iters")and 200or\'𒁁\'=="-"and 241or 1')or 5<<64>>64or 68));"${print(g+91)}$/";exit; "$'#{print(187);exit}'$/"; #< ?>wWWsssss {}#(prin 45)(bye){{{}#}#}#(prin 199)(bye) 46(8+9+9+9+9+=!) >* * * * *[[[[3+4*7*@] ] ] ]xxxxxxxxxxxxxxxxxxxxx
###;{e=1}={e:null};console.log e&&39||180;\
__DATA__="""  
#"  \
__END__
set pr'[puts 59][exit]\'':;@echo 185 #';set pr'-';pr 89;exit
ifdef ss 
1     ! !
2   !    !
9      !!
2#
#  
#  
#  
#PLACET,2<- #2FAC,2SUB#1<- #52FAC,2SUB#2<- #32FACREADOUT,2PLEASEGIVEUPFACs wwwwwwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWw W
jrzaeeaeuee_wuuwq jii_iullluiiiogr se_eeepaeeeeeeeeee;eeecisajjarpppppp ⠆⠄⡒⡆⡘😆😨😒😨💬95💬👥➡😻😹😸🙀🙀😹😼😿🙀🙀😼😼😸🙀🙀🙀🙀
👋🔢🌚🌝🌝🌚🌚🌚🌚🌚🐸🐸🐸🐸🐸🐸😂😂😂😂😂😂😂🌚🔥😂😂😂😂😂😂😂💯💩🐸🔥😂💞💩💞😂😂😂😂💞🔥🌚▲▲▲²²²²▲¡▼¡▲▲¡⎚¿⁵228¦ₔ₁₉₃2♦10♦10♦10♥☰䷩䷏䷏䷨䷏䷩䷩䷩䷩䷩䷩䷩䷩䷩䷩䷩䷩䷩⚎ֱֲֵֶֶֶֶַַַָָ  
밠밠따빠빠맣박다맣받다맣희맣희吾有一數曰二百八十一書之うんたんたんたんたんうんうんうんうんうんたんうんうんうんたんうんたんたんうんたんたんうんたんたんうんたんたんうんたんたんたんたんたんうんうんうんうんたんたんうんたんたんたんうんうんうんたんうんうんたんうんうんたんうんうんたんうんたんうんうんうんたんたんうんたんたんうんたんたんうんたんたんうんたんたんたんうんうん  
😊♈💖  ↨↑1↑↑↑↑↑↑↑↑↨21↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑2↨↑1↑↑↑↨↨0↑0↕→
😇♈♈  
😊♉♈  
😇♈♈  
😇♈♉  
😇♈💜  
😊♉♈  #e:>* * * * *[[[[828+*+@+*99] ] ] ]* * * * *<
😊📢♈  
😈♈💜  
😊📢♈  
😇♉💞  
😊📢♉🐸⠀⢃⠛⠋  
#-49,A,-1                              #
#-5,A,-1                               #
#6,A,-1                                #
XX  
x+------+XX   X       XXX
x|/0110@| X X  XXXXXXXXX X
x|/0011 | X X   XXXXXXX
x|/0010 | X
x|/0011 | 
x|/0001 | 
x|/$0011|  
x+------+  
#+    +
1   *xxxxxxx
53 x+       x x     xxx
1  x*  xxxx  xx   xx x  x
x  x  x  x  x x  x  x  xx
 +xx xxxxxxx +x xxxxxxx  xxxx
x  x   x      x   x
51  +xx        xxx
#  
1   *     x``   x  x
49 #+  xx+x=>+  x+x + x B+ ===+
#  =x x  x===  x x >8 xxx +++= +
#+  +x + x,_8=>+ xB  x+x
# =+R _*=x==  x +===+> x x    +
 x +R"12"+8=Dx B=xD +  + xxx+
#+ ``=>8=x>  x+~ x  x +x+B+
#  +====+x>~+B+= x x + x
#D~+x 8=++>8x +=   x+    +,_   +
15 + x   x  + +  xx   +  ?   ?@  %"18"_     !
1  + x   + x ++  xx   + ?@    ?
1 \+* x    +  +  x    +   +   *
1   ! x  +x   +       + ?  !  ?
1    ! x xx --... ...--  ? @ ?
x +   ++ xx  ++ ++     +
 +xxxxx  +     +
  
#= +
+ *   +
#= + *
#=**************************************************+>
  +  +$$$
#>"3"O._   +// rk:start | print: "69" rk:end       + e$P+++++*D*+++1++1E!s
   + ; + *
$'main' *****+ %++ %++ @@* %-- @@* %++ %++ @@*
 -+3o4o#  +
  <++"269">o+
^* *
 #+*****|
.x= #   +
,,  .=#
 #+ OOO       =#
 #^=
+`` 231 =#
#  #uuu#
,,..,.,,,,..,.,.,,..,,.,,,...,,.,,..,,,,,,..,,,.$
  
write 224;bye; 
  
 console.log 178;
  
~~~x  
main:Int  
main =248 
~~~  
literally, print 249
(print 164     (exit ) )
 ( *)
begin write         ('288'    )end.(*)
print 61
  
#<<<##>  
         print(85)
#<<<##>CO COMMENTp]] 
execute_process                            (COMMAND echo 296   )#[[
  
T:251  
E:0  
#+IDRIS: main:IO      (         );main=print 291
#ppW<#require"stdio"Stdio:write     (293  )#>;
#ceppp  ;  ;   ;
MsgBox (0,"",169   )
#cs  
Yo::=~147
::=  
You can see an x here.<<  
  
>{-<<<<<  
> 176
>> Output 1
>SET x TO 120. [0]{472454523665721469465830106052219449897}
>X x.   ;-}
>l=length$show"\0";main=print$[0,0,0,233,0,146,157]!!l{-
  
\begin{code}  
{- ;  ␉␉␉␉ 
␉
 ␉  



-}
open import IO;main = run (putStr"159" )
\end{code}
ppppppppppppp;pppppppppppppp
# {{{ {{{ {{{ {{
#!ZZt >>END-IF
#xxxh  program-id.h.procedure
#xxxg  diVision.display 230.
#}}}f >>IF 2>2
#}}}e
#xxxd
#xx}c
#}}}b
#x}xa















































































































































































































































































































































<script> onload=function   (){d=document;f=[].sort;d.body.style.display='block';d.body.innerHTML=/a/.__proto__=='//'?275:!/r/.test  (f  )?267:!/\n/.test(f)?257:!/^\n/.test(f)?259:d.documentMode?262:265}</script>
<style>body{display:none}html:after{content:"258";[;content:"276";]}@media \0 all{html:after{content:"266"}}@media screen and  (min-width:0\0){html:after{content:"260"}}</style>
<attache>Print[194]Exit[]</attache>
 
22-23-31-13-13-31-13-13-31-13-13-31-13-13-31-12-12-23-31-13-13-31-13-13-31-13-13-31-13-13-31-21-22-21-12-32
Take Northern Line to Tooting Bec
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Embankment
Take Bakerloo Line to Embankment
7 UP
Take Northern Line to Mornington Crescent
7 RIGHT
7 RIGHT
7 TEACH
6 BOND
6 BOND
6 BOND
5 RIGHT
5 LEFT
5 RIGHT
7 BOND
7 TEACH
5 TEACH
6 YELL
5 TEACH
6 YELL
6 YELL
#  ;
set ! 57
set ! 51
out &49 &1
out &56 &1
out &50 &1
When this program starts:
There is a scribe called x
x is to write 179

p now 70 dollar off!
p has been selling out worldwide!
More 91 of this
How much is it
red down one blue up red down one blue up red up one red right two blue up
baa baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeeeeet bleeeeeeeeeeeeet bleeeeeeeeeet baaaa bleet bleeeeeeeeeet bleeet bleeeeeeeeeet
#
ata#8;min;dnu&&1Prers>80::\0}ngt=Be;bk:peseps>Ex Cr u Uitharbodyh$/+--- $5"6c"2:F 4, ._#a*een gi=[ Show]pR 8ogr ca34* 16  prstd   
在ent
*/
 
#1""
#if!1
.int 2298589328,898451655,12,178790,1018168591,84934449,12597
#endif//*
#1""//*:
#include<stdio.h>
#define z(a) #a
#define u "e"//"
const char*i="24 10 31 1""a c #FFC0FF""B c #0000C0""d c #58007B""e c #0C8302""o c #FF8000""t c #FF00BC""u c #008080""h c #E60001""i c #CAFFFF""f c #280000""k c #CA0000""l c #CA007F""n c #330001 ""q c #E60000""A c #0040C0""E c #808000""F c #00C040""G c #008000 ""R c #800000""H c #0000AA""I c #00AA00""C c #55FFFF""K c #AAAAAA""r c red""g c green""b c blue""c c cyan""m c magenta""y c #FFFF00""x c black""_ c #FFFFFF""HHHahtdegggggggyrggggggc""IHHaixuEFbGGbggbryAEGRgc""CCHafyurbgbgggggggb____o""ICHakmyyyyyyyyyyyyyyyyye""I__almyyyyyyyyyyyyyyyyye""K__anmyyyyyyyyyyyyyy_y_e""HH_aqggyyyyyyyyg____m_Ce""CH_axxxxxxxxxxxxxxxxxxxx""K__aaaam___bbbbbBm_bbBab""K__________bbbbb___bbxbb";//"
typedef int known,macro;int x=!  '(',y[60];macro m(){0;}int f(int a,...){y[x=0]=x=72;printf("\x25i",!m?195:!a?124+x:sizeof' '-1? (1&*z (N)?234:"\??-"[1]?218:67^*u""):*u""?37:z (0'0  0'0 )[7]?75:"\??-"[1]?77+a/2:77);}__attribute__((weak))int main(){known y;int i;f(x,x=sizeof y);x=1;return 0;}__attribute__((destructor))int g(){x?0:puts("198");}//())*/
#1""/*/
<<<<<<<<<<WQTkTTX
 
 
>import Prelude;import GHC.IO;import Data.Functor.Const;import Data.String;import Text.Heredoc;import Control.Exception;import Language.Haskell.TH;import Text.Show.Functions;instance Monoid a=>Monad (Const a)where _>>=_=mempty
>instance K Float;instance IsString Integer where{fromString _=0};instance Num B where fromInteger _=B 170;negate _=B$ x#x
>data B=B{u::Int};e=error"#"; f?n=unsafePerformIO$ catch (f e )$ \ErrorCall{}->r n;instance Num(a->b  );instance Num();instance Show  (Q a)where{show _=""};f=(^);q _=r$ (d.B )?4;d(B _)=r$0`f`f 2 64;class(Show a,Floating a)=>K a where{k::a->String;k _=show$ (id::a->a)pi};g=[here|here<-""]--[|]
>--W
>x=0;y#a=subtract 0b1206;x#a=174;h b=b^x;r=pure ;l a=length$ show a;forall=0;z| (∀)<-5=forall;b1206|let _._=x;negate _=3=[246,264,0,263,261,232,222,209,210,128,206,207,214,211,212,217]!!(l("  ",0x0.1,1e1,  (0`id`),k(0::Float),toEnum 0::Num a=>Enum a=>a)+2*l(do a<-Const[1];pure a,h pi,h (0::Real a=>a))- 3*(l$(pure$TupE[]::ExpQ))-(-q?6+70+z));(!  )=seq
>;
>main|let p!_=0=print$ sum[0!61,{-_-}last$172:[u$[-1]!!0|g<">"] ]--} 
 
#1""/*/
#if!1
#endif//*
/*/
#if!1
_;
select 192;
.exit
print1(292                       )
quit
#endif
p=sizeof("   (\");print'(''72'')';end !" );main(){puts('??-'&1?"101":"92" );return 0;}
#if 0
#endif//*
#}
disp 49
#{
}{}<>
 /._++.._# !._++.-.>@
#:  /
 \?     -/!  +++++++++++++++++++++++++++++++++++++++++++++++++<>^+++++<\>+++.-.
rebol[ ]prin either Value? 'disarm[223][270];red[ ]prin 221;  + #.---.>/
#s{  /<+>/   K yya+-        &  g+$
endif#                A=AgRA;       AC
# {\
""";'"#{'#'}'}'
#@[[[["272"?]] #]]******<
#<<<#
#ce:  ~#class C{function:Main(a:String[])~Nil{83->Print();}}#$/
#endcomment;K`250
#nocomment outtext("155" )
#/`psZ283MIOnDrFe @,,,"284_"># 01-:2/_;:@,,,"285"_+1y2"982"2k,# @#;# k-'1:,,@_  pS9^7^8^MUOUOF
#\!|!o51   ;        ~nJQ  p'34'  \=#x=4;print(1>>-1<2 ? 17 : Inf16-0|>sizeof>2 ? 162 : √4x<8 ? 201 : 225+2>>1*2 )#p⟫try {EVAL 'say 「27」;exit'};say 237#⟫say 167#{{p{{}}}}say 235#]#print(47)#]#echo 21#>         :/aa*7+42@n;/#print(171)#s-#print 175#s|#print(208)#sCOMMENTprint("65" )#ERi521@<[[["172"?]]]]* * * * * *<es9#
#8M`|  <esc>dggi2<esc>// :~- <~-< ~-<<<~-! `=> #
#1//  >>END-IF*>>>9#
# '>+/*' 25  >[};]+ pppppeee^e*n*\              \! 99n*n*es*s      \*s*ee*n*n*n*e*sss*e*n*n*n*ee*js "( *)//dd"    <e 5>1  */// \)∙226p|_|_X222999612#

Try it online!

I call the interpreter like this:

import sys
from _110010000100110110010 import interpret
interpret(open(sys.argv[1], encoding='utf8').read())

Handy table:

Command pointer:
 nil → 0:   ↕
 nil → 3:   ↨
   1 → nil: ↨
   3 → nil: ↨
   3 → 2:   ↑
   2 → 3:   ↑
   2 → 1:   ↓
   2 → 1:   1 (same as above)
   2 → 0:   0
 ---------------
   0 → 2:   ↕ (but also prints the data pointer)
 ---------------
 nil → 1:   ↨↑1
   1 → 0:   ↨↕
   1 → 3:   ↨↨
   3 → 0:   ↑0

The simple way to print a number is ↑↑↑↑↑↑↑↑↑↑ ↕↕. But 300 takes 900 bytes, better use a loop. To create a bf-like loop, we need to be able to switch command pointer from 0 to nil, but this can't be done without printing the data pointer. So I use jump offset as a loop counter and the data pointer as an accumulator.

↨↑1      cmd_ptr = 1
↑↑↑↑↑↑↑↑ jmp_offset = 8

↨        cmd_ptr = nil
21       jump forward (on the first run: data_ptr = 1)

*** loop ***
↨↨       cmd_ptr = nil
↑        data_ptr++
...

↨↨↑

2        filler
↨↑1      cmd_ptr = 1
↑↑↑      jmp_offset += 3
↨↨       cmd_ptr = 3
0        jump back (ip -= jmp_offset)
*** end loop ***

↑0       cmd_ptr = 0
↕        print data_ptr

The loop element is ↨↨↑. The single switches the command pointer from 3 to nil after the jump, ↨↨ doesn't change the command pointer when it is nil (when executing sequentially).

Code without comments:

↨↑1↑↑↑↑↑↑↑↑↨21↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑↨↨↑2↨↑1↑↑↑↨↨0↑0↕

The loop is executed like this:

    2<-------------+
+---1 break        |
|   ↨              |
|   ↨<----------+  |
|   ↑           |  |
|   ↨           |  |
|   ↨<-------+  |  |
|   ↑        |  |  |
|   ↨        |  |  |
|   ↨<----+  |  |  |
|   ↑     |  |  |  |
|   ↨     |  |  |  |
|   ↨<-+  |  |  |  |
|   ↑  |  |  |  |  |
|   2  |  |  |  |  |
|   ---+--+--+--+--+
+-->

After the loop the data pointer is 1+2+..+(n+1), where n is the number of ↨↨↑ elements. For n=23 it is 300.

borks exit code of Symbolic Brainfuck, it is fixed with . The code size exceeded 14000, so I added another 10 Ws to AlphaBeta code.

\$\endgroup\$
2
  • 6
    \$\begingroup\$ Congrats on 300! \$\endgroup\$
    – iPhoenix
    Commented Oct 4, 2020 at 16:30
  • \$\begingroup\$ This whole thing is so damn beautiful. I kinda want to put this on an NFT. \$\endgroup\$
    – Chance
    Commented Apr 2, 2021 at 4:14
14
\$\begingroup\$

33. Incident, 460 bytes

#v`16/"<"6/b.q@"(: ::T):  ␉␉␉␉ :(22)S#;n4"14"
#>3N6@15o|>␉^*ttt*~++~~~%
#=~nJ<R"12"; ␉
#[␉#vx#v0l0mx01k1k0l0ix0jx0h0h1d111x0ex0bx0b0o1d0b0e0e00x1d0i0fx0g0n0n11x0o0n0cx0c0o0f0c0gx0g0f0h0j0j0i0001k10mx0m0l11111100(23!@)
#`<`|
print((eval("1\x2f2")and (9)or(13))-(0and 4)^(1)<<(65)>>62)or'(\{(\{})(\{}[()])}\{})(\{}\{})'#46(8+9+9+9+9+=!)=#print(17)#]#echo 21#|/=1/24=x=9[<$+@+-@@@@=>+<@@@=>+<?#>+.--.]/
#8␛dggi2␛␉` |1|6$//''25  #>say␉␉ 27#T222999/+/-/+23!@23!@"26

As usual, is a literal tab, is a literal ESC character.

Rundown

This program prints 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Try them online!

For the languages that aren't supported by the above test driver:

  • V can be tested here on TIO, and outputs 2 as expected.
  • Reng can be tested here, and outputs 19 as expected.
  • Modular SNUSP can be tested here, and outputs 31 as expected.
  • Incident currently doesn't have an online interpreter; I tested it locally. I've put in a request for it to be added to TIO, though.

Explanation

I was always planning to add Incident once this challenge reached its 33rd language. You see, it takes a huge amount of code to do anything in Incident, and 33 is by far the simplest (and thus tersest) two-digit number to output. Even then, I only just came in under the length restriction.

Making the Incident code robust against changes to the polyglot

The main weird feature of Incident is that it's very hard to lex; as a quick summary, a token is anything that appears exactly 3 times in the input, and isn't a subset of another token, and doesn't overlap another token. It'll be much easier to understand this answer with syntax highlighting. Stack Exchange doesn't support colour in posts, and (unsurprisingly) doesn't support syntax highlighting for Incident, so I'll do it with a screenshot of a slightly older version (click for full size):

The polyglot, with syntax highlighting for Incident

The tokens are shown in bright, bold colours. Dim colours are for non-tokens; grey means that they don't occur 4 times, brown shows tokens that are invalid due to overlapping other tokens (and dark cyan shows the locations of the overlaps).

As you can see, the #v at the start of the program is a token (appearing three times), and as it follows the pattern #v … #v#v (appearing once and later twice), compiles into a forward jump, thus jumping over the start of the code. Likewise, 23!@ is a token, and follows the same pattern, and thus is a forward jump that jumps over the end of the code. As such, Incident won't execute anything but the Incident code in the middle of the program. The Incident code is interleaved with the Whirl code; the purpose of this is to reduce the chance that Incident tokens will appear in future added code and thus cause the Incident code to lex incorrectly. Each token in this code consists of a digit (0 or 1), followed by a lowercase letter (other than a, as the program already has a 0a). So avoid that combination in future. (The reason I used this particular representation was that the Whirl code was already full of 0s and 1s that I could borrow.)

The most fragile part of this program, and something that's unavoidable in Incident, is the part that does the output; this is the token 0o (seen underlined in the syntax highlighting; I chose the name 0o as "output" starts with o). Incident identifies the token that produces output via checking for the centremost token in the entire program; this happens to hit an 0o right now, but might not in the future, so you may have to add dummy tokens (i.e. something repeated three times that doesn't appear elsewhere in the program; three copies of the same token next to each other is a no-op in Incident) in order to bring it back to the centre. Hopefully this will at least be less obnoxious than dealing with the Hexagony.

Keeping the other languages working.

Given that this answer pretty much just adds a bunch of letters in the middle of the program, few languages minded.

One of the more awkward languages to deal with is Reng; there's naturally a # in its execution path. Luckily, this can be fixed easily by adding a (non-token) x on the sixth column; Reng treats this as a no-op, and Incident doesn't parse it as a token (as the program has a ton of xes already).

Hexagony was fairly benign; I just needed to add padding to line the /+23!@ into the right place on the line. (Note that the second occurrence of 23!@ is for Incident, giving three copies of that token; you may well want to change the 23!@ token to something else if you move the Hexagony token earlier on the line, and the basic principle is just that the token in question should appear once at the end of the Incident line, twice very near the end of the program, and not appear anywhere else.)

Unfortunately, my first thought for the padding (++++) broke Retina. I changed it to /+/- instead, to ensure that it was valid within a regular expression (and didn't accidentally create an Incident token); Retina hardly runs the code at the end of the last line (it's already matched enough times by then so the value will be thrown away), but it does parse it.

The other language that gave some amount of trouble was Prelude, which produces when it sees ! characters. Parentheses, on any line (not necessarily the same line as the ! character), affect control flow in Prelude; thus the ! characters on the last line are harmless. The ! character at the end of the Incident code isn't, though, so I had to enclose the 23!@ there in parentheses; luckily, 0(…) is a comment in Prelude, and there's a 0 naturally at the end of the Whirl program.

How the Incident code works

Here's the Incident-specific (plus interleaved Whirl) section of the code, with tokens bolded and whitespace and comments added:

0l 0m x 0                 # Run subroutine 0l, then jump to 0m
1k 1k                     # Jump target for backwards jump 1k
  0l                      # Entry and exit point for subroutine 0l
  0i x 0j x               # Run subroutine 0i, then jump to 0j
  0h 0h                   # Jump target for backwards jump 0h
    1d 1 1 1 x 0e x       # Run subroutine 1d, then jump to 0e
    0b x 0b               # Jump target for backwards jump 0b
      0o                  # Output a 0 bit, then run subroutine 0o
      1d                  # Entry and exit point for subroutine 0o
    0b                    # Jump back to jump target 0b
    0e 0e 0 0 x           # Jump target for forwards jump 0e
    1d                    # Run subroutine 1d
    0i                    # Entry and exit point for subroutine 0i
    0f x 0g               # Run subroutine 0f, then jump to 0g
    0n 0n 1 1 x           # Jump target for backwards jump 0n
      0o                  # Entry and exit point for subroutine 0o
    0n                    # Jump back to jump target 0n
    0c x 0c               # Jump target for backwards jump 0c
      0o                  # Output a 1 bit, then run subroutine 0o
      0f                  # Entry and exit point for subroutine 0g
    0c                    # Jump back to jump target 0n
    0g x 0g               # Jump target for forwards jump 0g
    0f                    # Run subroutine 0f
  0h                      # Jump back to jump target 0h
  0j 0j                   # Jump target for forwards jump 0j
  0i 0 0 0                # Run subroutine 0i
1k 1                      # Jump back to jump target 1k
0m x 0m                   # Jump target for forwards jump 0m
0l                        # Run subroutine 0l

First, note the random digits scattered around (these are bits of the Whirl code, which is slightly longer than the Incident code); we don't care about those. The random xs are to avoid parsing ambiguities (basically to prevent an overlap between a digit-letter token and a letter-digit token, we use xs to break up letter-digit tokens). Everything else is tokens, and those are the bits that are actually executed; all nontokens are NOPs.

The next thing to note is that this is almost entirely made out of jumps and procedure calls. An Incident procedure has its exit point at the same place its entry point is, and thus we use jumps to loop each of the procedures round into a cycle (i.e. we enter at one point, run forwards until we reach a jump, jump backwards, then run forwards until we reach the entry point again). Additionally, Incident cares about the order of the three uses of a token (it's how it assigns meaning to them), so there are also some extra jumps added simply to get the code into a sequence that will be interpreted with the meaning we want. We can straighten out the jumps to get the following pseudocode for the procedure definitions:

Main program: call 0l; call 0l.
          0l: call 0i; call 0i.
          0i: call 0f; call 0f; call 1d; call 1d.
          0f: call 0o (outputting a 1 bit as a side effect).
          1d: call 0o (outputting a 0 bit as a side effect).
          0o: a no-op.

Note that each Incident procedure has to be called from exactly two places in the program (due to the way the syntax works); it's easy to verify that that's true in the table above. (If the centremost token in the program is a procedure definition – 0o in this case – the two calls output 0 bits and 1 bits respectively as side effects.)

It should be fairly easy at this point to see what the program outputs: the bit pattern 1100110011001100. This is broken into bytes, taking the least significant bit first. So that's 33 33 in hexadecimal. And of course, hexadecimal 33 is ASCII 3. The program could thus be made significantly simpler by exploiting the fact that 33 is the only 2-digit decimal number which consists of the same nybble repeated four times; and that let me fit it into the polyglot.

\$\endgroup\$
1
  • \$\begingroup\$ Wow! So glad I blew up the byte count now. \$\endgroup\$
    – Chance
    Commented Jan 17, 2017 at 21:44
14
\$\begingroup\$

8. Retina, 70 bytes

#v;7||"<+0+0+0+<;n4
#>3N.
#|\w*
#8
#|

#M`
print('1'if 1/2else'5')
#i2

Try it online

This program prints 1 in Python 3, 2 in V, 3 in Minkolang v0.15, 4 in ><>, 5 in Python 2, 6 in SMBF, and 7 in Japt.

Explanation:

#v;7||"<+0+0+0+<;n4     # replace every empty string with "#>3N."
#>3N.
#|\w*                   # replace words chars with "#8"
#8
#|                      # remove all "#". The "|" is something I could've golfed off.

#M`                     # match all places between characters (finds 8)
print('1'if 1/2else'5') # replace something that won't be found. noop
#i2
\$\endgroup\$
4
  • \$\begingroup\$ This is 2 bytes too long (50 + 20 is 70, 50 + 20% is 60). \$\endgroup\$
    – user62131
    Commented Dec 6, 2016 at 20:30
  • 1
    \$\begingroup\$ @ais523 Fixed it. \$\endgroup\$
    – mbomb007
    Commented Dec 6, 2016 at 20:36
  • 2
    \$\begingroup\$ Care to provide an explanation? If not, that's ok. \$\endgroup\$ Commented Dec 7, 2016 at 5:41
  • \$\begingroup\$ @MistahFiggins Sure. Added. \$\endgroup\$
    – mbomb007
    Commented Dec 7, 2016 at 14:44
13
\$\begingroup\$

19. Reng, 152 bytes

#v`16 "<" 6/b0\ .q@#;n4"14""
#>3N9@15o|R"12"*^*ttt*~++%
#=|
print((1/2and 9 or 13)-(0and+4)^1<<65>>62);# =#;print(17)
#       ~nJ<
#
#gg99ddi2` |1|1+6

I added another #\n so that retina would cooperate. Here's how it works:

# redefines v to push 0, the default TOS. Then, it negates the TOS (`), pushes 1 and 6, the character of <, pushes 6 again, and mirrors upwards with /, colliding with the other `, which negates the 6. Then, it hits the <, pushes J (base 36 for 19), then outputs it as a number, finally terminating (~).

Escapes in between 2 and `; and # and g.

  1. Try it online!—Python 3
  2. Try it online!—V
  3. Try it online!—Minkolang
  4. Try it online!—><>
  5. Try it online!—Python 2
  6. Try it online!—SMBF
  7. Ethproductions—Japt
  8. Try it online!—Retina
  9. Try it online!—Perl
  10. Try it online!—Befunge 93
  11. Try it online!—Befunge 98
  12. Try it online!—Fission
  13. Try it online!—Ruby
  14. Try it online!—Turtléd
  15. Try it online!—Haystack
  16. Try it online!—Pyth
  17. Try it online!—Julia
  18. Try it online!—Cardinal
  19. JSFiddle—Reng
\$\endgroup\$
0
13
\$\begingroup\$

24. Thutu, 211 bytes

Fourth try. Hopefully the implementation is uncontroversially valid this time.

#v`16/"<"6/b.q@"(::):::  (22)S#;n4"14"
#>3N6@15o|> ^*ttt*~++~~~%
#=~nJ<R"12";
#[
#|
print((eval("1\x2f2")and 9 or 13)-(0and+4)^1<<65>>62)#@46(8+9+9+9+9+=!)=#print(17)#3]#echo 21#===2|/=1/24=x=9+/
#8␛dggi2␛` |1|6

␛ represents a literal ESC character, as usual.

As far as I know, there isn't a Thutu implementation that works in a browser yet. I used the implementation in the Esoteric Files Archive, which is a compiler from Thutu to Perl (basically, compile the Thutu into Perl, then run the Perl). Update: Since I wrote that, the language has been added to TIO. So now you can:

Try it online!

This program prints 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng (test here), 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in Vim/V, and 1 in Python 3.

I had to pretty much redo the Hexagony part of the solution. It turns out to be easiest to run the Hexagony code on a diagonal, rather than horizontally:

        # v 1 6 / " < " 6
       / b . q @ " ( : : )
      : : : ( 2 2 ) S # ; n
     4 " 1 4 " # > 3 N 6 @ 1
    5 o | > ^ * t t t * ~ + +
   ~ ~ ~ % # = ~ n J < R " 1 2
  " ; # [ # | p r i n t ( ( e v
 a l ( " 1 \ x 2 f 2 " ) a n d 9
o r 1 3 ) - ( 0 a n d + 4 ) ^ 1 <
 < 6 5 > > 6 2 ) # @ 4 6 ( 8 + 9
  + 9 + 9 + 9 + = ! ) = # p r i
   n t ( 1 7 ) # 3 ] # e c h o
    2 1 # = = = 2 | / = 1 / 2
     4 = x = 9 + / # 8 ␛ d g
      g i 2 ␛ | 1 | 6 . . .
       . . . . . . . . . .
        . . . . . . . . .

The bold font doesn't show up that well for me, but nonetheless, I've boldened the route that the IP takes. There's only one IP used, this time, and it hardly runs any commands. The program starts by pushing some junk to the memory edge, then replacing its value with the sum of the memory edges to either side (which still have their initial value of 0), thus resetting memory to all-zeroes. Then we can just do 23!@ to print 23 and exit.

Thutu doesn't like blank lines. As such, I had to replace Retina's blank line (which matches anything) with #| (which also matches anything).

Thutu also cares a lot about slashes; they're the main syntactical element of the language. Luckily, # at the start of a line is a comment in Thutu, so we only have one line to worry about. However, # inside a line is not a comment, so the big long line is something of a concern. As such, I had to hide the slash from Thutu by placing it inside an eval. Luckily, both versions of Python, Perl, and Ruby all have an eval, and will all unescape \x2F into / inside a string delimited by ". Unfortunately, the use of " makes the code live in Pyth, and can easily cause syntax errors (e.g. eval("1\x2F2") is a syntax error), but we can use a lowercase \x2f and Pyth will be OK with that, at least syntax-wise (it's in a part of the code that never runs, so we don't have to worry about what it actually does).

Thutu interprets most of the big long line (up to the first slash) as a regular expression. As such, the Prelude code was causing problems, as +++ is too much quantification. However, it was fairly easy to fix that by re-associating the uses of +.

So how does the Thutu work? Most of the code is a comment, with only one line of code. Thutu's kind-of like Retina; it works by repeatedly regexing a working space. Initially, the input is =1. We first check to see if it matches the regex print(( … ===2| (it does, because most (all)? regexes ending with | will match anything). Then we replace one occurrence of =1 with 24=x=9+. At the end of each cycle, the Thutu implementation will output everything before =x (i.e. 24), exit (due to the presence of =9), and keep the + (which we don't care about) for the next cycle (which doesn't exist).

In terms of places where code can be added, the main offender is Hexagony, which is incredibly fragile in the current case. As such, I suspect that the last line is currently the easiest place to add code if you don't want to redo a large amount of work. The 6 at the end is used for SMBF, but the |1| is used only by Retina, which can cope with any other regex there that's matched a lot of times, and Vim; a few 2D languages will pass over the line but will consider most characters fairly harmless. Before the first ESC is touched even less, with only Retina caring (although if you go too far right, you'll affect some 2D languages, like before). Note that there's a limit to how long the code there can be, because if the Hexagony side length gets thrown off, everything will break.

If you're willing to redo the Hexagony, the long line is still a good place to add code, although slightly worse than before. The ===2 is purely Hexagony, and will hardly be seen by other languages (although Thutu wants it to be a valid regexp, Prelude doesn't want parentheses or exclamation marks, SMBF doesn't want periods or mismatched brackets). Earlier in the line (the #@) is also a safe place to add code so long as you're careful with Thutu and SMBF, and redo the Hexagony; you may need to add a 0 or two at the end of your code to prevent it confusing the Prelude code later.

Finally, if you're prepared to dodge the 2D languages, the #| line is pretty much entirely free, with only Retina and the occasional wild two-dimensional instruction pointer causing problems.

\$\endgroup\$
0
13
\$\begingroup\$

32. Whirl, 388 bytes

Program

#v`16/"<"6/b.q@"(: ::T):  ␉␉␉␉ :(22)S#;n4"14"
#>3N6@15o|>␉^*ttt*~++~~~%
#=~nJ<R"12"; ␉
#[␉00011000001111000010000010000011000000000000000001100011111100
#`<`|
print((eval("1\x2f2")and (9)or(13))-(0and 4)^(1)<<(65)>>62)or'(\{(\{})(\{}[()])}\{})(\{}\{})'#46(8+9+9+9+9+=!)=#print(17)#]#echo 21#|/=1/24=x=9[<$+@+-@@@@=>+<@@@=>+<?#>+.--.]/
#8␛dggi2␛␉` |1|6$//''25  #>say␉␉ 27#T222999+/+23!@"26

As usual, is a literal ESC character and is a literal tab.

Rundown

This program prints 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Explanation

First off, thanks @ais523 for the Polyglot Test Driver! It helped testing tremendously. I'll need help updating it for this solution.

Whirl is, well, maybe you should look at this flash representation first.

Whirl only reads 1's and 0's and the only performs operations when it reads 2 consecutive 0's. So this is a really easy one to fit in and is unlikely to break on future additions. 1's just spin the dials and singleton 0's switch between the dial being controlled.

I debated with myself about going with this solution because it's so byte heavy, but ultimately decided that it would be worked in eventually, since it can fit in so easily, and #32 is the best place for it since round numbers are much easier. In code we're adding up to 2 then multiplying by 2 until we hit the magic number.

The long binary looking string could be moved elsewhere if needed in the future, but you may need to rework the solution using the flash program if you lose track of where the dials are pointing, which is very easy to do. Keep in mind that there are 4 1's in code prior to the Whirl string, which are integral to the correct output. Everything after this irrelevant dial spinning, like a DJ that forgot to power the turntables.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I was actually considering Whirl for 31, but that language is a pain to write in (and I wasn't aware of the Flash program), and I also hadn't cottoned on to the fact that 32 would be easier. So you were way ahead of me on this one. (Also, thanks for setting up #33!) \$\endgroup\$
    – user62131
    Commented Jan 17, 2017 at 22:48
13
\$\begingroup\$

99. 99, 2943 bytes

#16  "?63(o?23!*# #@"/*\DZZCv;'[af2.q]PkPPX)\('#CO"14"; */
#/*0|7//```"`  [>.>.])[-'][(>77*;,68*,@,1',;# l1011)(22)S\4n;iiipsddpsdoh coding:utf8ââââ(1P''53'S^'????!?!??!??!!!!???!?!??!!?!?!!!!!?!!!!?????!????????????????????!) (qx
#>â
# 36!@â`  e++++++::@ 
#~
#y
#`<`
#<<<#>>]}}+<[<<.>>x>-]>[
#{
#x}
#2""/*\*
#=x<R+++++[D>+++++++q   L+++<-][pPLEASE,2<-#2FAC,2SUB#1<-#52FAC,2SUB#2<-#32FACREADOUT,2PLEASEGIVEUPFACs]>@@+.---@.>][
#x%+>+=ttt Z_*.
#D>xU/-<+++L
#R+.----\   \).>]|
#[#[(?24O6O@?20l0v01k1kMoOMoOMoOMoO MOO0l0ix0jor0h0h1d111x0eU0y0yx0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k1x0vx0v0l111111^_0 )0\\
[  "]56p26q[puts 59][exit]" ,'\[999'];#/s\\/;print"24";exit}}__DATA__/
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.<!\
'(wWWWwWWWWwvwWWwWWWwvwWWWw WWWWWWWWwWW/"78"oo@WWwWWWWWWWwWWWWWWWWwwwwvwWWWwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWw              (([5]{})))â\';';print((eval("1\x2f 2")and 9or 13<< (65)>>65or 68)-(0and 4)^1<<(65)>>62)or"'x"or' {}{}{}{}({}<(((((()()())){}{})){}{})>)(({})5){}x{(x<(<()>)({})({}<{}>({}){})>){({}[()])}}({}){}({}()<()()()>)wWW no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no os sp '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("3'3)))"'a'[[@*3*74[?]*]*(<*.*\>]xxxxxxxxxxxxx)'# \\
__DATA__=1#"'x"
#.;R"12"'
###;console.log 39;'(******* **********819+*+@[*99[?]*]***|!)'
#\\
""""#\
' ( <><        (          )>  ){ ({}[()]  )}{\';      a=$(printf \\x00    );b=${#a};#\\
" }"';           ((   ( (';case "{"$ar[1]"}"${b} in *1)echo 54;;*4)echo 78;; *1*)echo 50;;*)echo 58;;esac;exit;# (((('))))#\
=begin
#p             +555/2+55x%6E2x
;set print "-";print 89;exit#ss 9
utpb now 70 dollar off!
utpb has been selling out worldwide!
#9999 9 seeeemPaeueewuuweeeeeeeeeeCis:ajjapppppppðð¨ðð¨ð¬95ð¬ð¥â¡
ðð¢ðððððððð

set ! 57
set ! 51
More 91 of thiset of re9
How much is it*/
#if 0
.int 2298589328,898451655,12,178790,1018168591,84934449, 12597
#endif//*
#1"" //*
#include<stdio.h> 
#defineâ x(d)â#d
#define u8 "38\0 "
main ( ) {puts( sizeof (0,u8)-5?u8"67":*u8""?"37":     x( 0'0  "'\"")[9]?"75":'??-'&1? "79":"77");"eg5""6 27""e ' Zing  ";}//*/
#if 0
#endif//* --... ...--
/*/
p=sizeof("9( 999 99\"    ); print'(''72'')';end!"            );main( ){puts(  "92");return(9-9+9 -9);}
#if 0â
#endif//* rk:start | print: "69" rk:end<(9    >5b*:,1-,@
print 61
#}
disp 49 ;9;
#{
}{}<>
$'main'3
#-3o4o#$$$
#<T>"3"O.</+++++++>/+++<-\>+++.---.
#<<<#>>> /
reg end="";print(85);reg s#++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-.
=end
;"""#"#xxxxxxxy"78"\++++>/<~#class P{        function:Main(a:String[] )~Nil{83->Print();} }
#}pS9^7^8^MUOUOF@:8:8\\
#s|)o51~nJ;#:p'34'3  \=#print(17)#>27.say#]# print(47) #]#echo 21#fwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwvm>++++
#s8âdggi2âM`|$//''  1$6~-<~-<~-<<<~-COprint ("65")#asss^_^_#
#9 "25"  +/ *///X222999686#

VIP score (Versatile Integer Printer): .003033 (to improve, next entry should be no more than 3032 bytes)

This program prints 1 in Python 3, 2 in V/Vim, 3 in Minkolang, 4 in ><>, 5 in Python 2, 6 in SMBF, 7 in Japt, 8 in Retina, 9 in Perl 5, 10 in Befunge-93, 11 in Befunge-98, 12 in Fission, 13 in Ruby, 14 in Turtlèd, 15 in Haystack, 16 in Pyth, 17 in Julia, 18 in Cardinal, 19 in Reng, 20 in Prelude, 21 in Nim, 22 in Underload, 23 in Hexagony, 24 in Thutu, 25 in Pip, 26 in 05AB1E, 27 in Perl 6, 28 in Brain-Flak, 29 in Trigger, 30 in Whitespace, 31 in Modular SNUSP, 32 in Whirl, 33 in Incident, 34 in Rail, 35 in INTERCAL, 36 in Labyrinth, 37 in C++03, 38 in C99, 39 in CoffeeScript, 40 in Minimal-2D, 41 in brainfuck, 42 in evil, 43 in reticular, 44 in alphuck, 45 in PicoLisp, 46 in Cubix, 47 in Lily, 48 in Deadfish~, 49 in Octave, 50 in Bash, 51 in Assembly, 52 in COW, 53 in Shove, 54 in Zsh, 55 in Brain-Flak Classic, 56 in dc, 57 in Wise, 58 in Ksh, 59 in Tcl, 60 in Moorhens, 61 in S.I.L.O.S, 62 in Grass, 63 in Brian & Chuck, 64 in Agony, 65 in ALGOL 68, 66 in Surface, 67 in C11, 68 in Python 1, 69 in rk-lang, 70 in Commercial, 71 in what, 72 in Fortran, 73 in Morse, 74 in Archway, 75 in C++11, 76 in Trefunge-98, 77 in C++14, 78 in dash, 79 in C++17, 80 in Klein 201, 81 in Klein 100, 82 in Brain-Flueue, 83 in Objeck, 84 in Klein 001, 85 in zkl, 86 in Miniflak, 87 in Alice, 88 in PingPong, 89 in gnuplot, 90 in RunR, 91 in Cood, 92 in C89, 93 in Set, 94 in Emotinomicon, 95 in Emoji, 96 in EmojiCoder, 97 in Cubically, 98 in Archway2, 99 in 99

Verification

Try it Online!

Languages currently not on TIO:

Explanation

99 is a language that only cares about 9s newlines and spaces. Each line falls into one of 4 forms (excluding nop lines) depending on whether there is a space before the first 9 or not and whether there are multiple space seperated groups of 9s or not.

Lines that have only one variable (group of 9s) and have no spaces before that variable are print statements. Lines that have only one varable but preceded by at least one space prompt for input. Lines that have multiple variables but no space before the first variable are assignment via alternating sum. Lines that have multiple variables and spaces before the first variable are conditional jumps.

The code this answer is based off is this:

9999 9 9          // assign 0 (9-9) to 9999
9 999 99 9999 9   // assign 881 (999-99+0-9) to 9
9                 // print 99 because 881/9 = 99 and 9 is a variable with an odd number of 9s

The code in the answer also includes a lot of conditional jumps that don't activate. These mostly came from adding extra 9s to prevent input statements from being in the code.

A code formatter for 99 has been added to the test driver if you want to see the full program.

The 3 main lines of the program are located:

  • near the Evil

    #9999 9 seeeemPaeueewuuweeeeeeeeeeCis:ajjappppppp😆😨😒😨💬95💬👥➡
    
  • inside the Fortran/C89

    p=sizeof("9( 999 99\"    ); print'(''72'')';end!"            );main( ){puts(  "92");return(9-9+9 -9);}
    
  • on the 5th last line

    #}pS9^7^8^MUOUOF@:8:8\\
    

Pip

Pip was the only language that gave me any real trouble and even that was fairly minor. I had to get a 9 into the last line to avoid the creation of an input statement for 99. This was achieved by replacing the 5 that we were using as a dummy argument to the # operator with the 9

\$\endgroup\$
2
  • \$\begingroup\$ Heh. Good language choice. \$\endgroup\$
    – MD XF
    Commented Jul 30, 2017 at 21:12
  • \$\begingroup\$ @MDXF I have been waiting out since the late 80s or so to add it. \$\endgroup\$
    – Potato44
    Commented Jul 31, 2017 at 3:46
13
+500
\$\begingroup\$

47. Lily, 938 bytes

#16  "(}23!@)" 3//v\D(@;'[af2.q]GkGGZ'#)"14";n4
#/*` "[!PPP(22)SP(>7 7*,;68*,@;'1,@ ␉␉␉␉ q
#>␉
# >36!@␉
#`<`
#<]+<[.>-]>[
#{#z}
#=<xR+++++[D>+++++++L+++<-][PLEASE,2<-#2DO,2SUB#1<-#52PLEASE,2SUB#2<-#32DOREADOUT,2DOGIVEUPDO]>+.---.>][
#Rx%>~~~+ +~*ttt*.x
#D>xU/-<+++Lnd
#R+.----\).>]|
#[#[kGkGx@O6O4/0l0v01k1k(0l0i0jx0h0h1d111x0eU0bx0b0o1d0b0e0e00m1d0i0fx0g0n0n11x0o0n0cx0c0o0f0c0gx0g0f0h0j0j0i0001k10vx0v0l11111100^_)46(8+9+9+9+9+=!)
###|
print( (eval ("1\x2f2")and(9)or(13))-(0and 4)^1<<(65)>>(62))or'({({1})({1}[(0)])}{1}\{1})'#}#(prin 45)(bye)|/=1/24=x<$+@+-@@@@=>+<@@@=>+<?#d>+.--./
__DATA__=1#//
#.\."12"__*
###;console.log 39
""""#//
=begin //
#ssseemeePaeueewuuweeeeeeeeeeCisajjapppp/*/
#define z sizeof'c'-1?"38":"37"
#include<stdio.h>
main(   )/*/
#()`#`\'*/{puts(z );}/*'``
$'main'//
#-3o4o#$$$
#<.>"3"O.
=end #//
"""#"#//
#|o51~nJ;#:p'34'\
#ss8␛dggi2␛ `|1|6$//''25  =#print(17)#>27.say#]#print(47)#]#echo 21#ss*///^_^_Z222999"26

is a literal tab, a literal ESC character; Stack Exchange would mangle the program otherwise. I recommend copying the program from the "input" box of the TIO link below, if you want to work on it.

Try it online!

VIP score): .009034 (to improve, next entry should be no more than 999 bytes)

Rundown

This program prints 47 in Lily, 46 in Cubix, 45 in PicoLisp, 44 in alphuck, 43 in reticular, 42 in evil, 41 in brainf***, 40 in Minimal-2D, 39 in CoffeeScript, 38 in C, 37 in C++, 36 in Labyrinth, 35 in INTERCAL, 34 in Rail, 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Most of the languages are tested by the test driver shown above.

Reng can be tested to output 19 here. I’m not positive this doesn’t have an error, if someone could verify…?

Modular SNUSP can be tested to output 31 here.

Cubix’s cube shape viewed here

Incident is checked by keeping the tokens balanced as described in previous answers.

VIP

I’m happy to announce that with the addition of Lily today, we officially have the lowest VIP score of all time. And so, I do hereby proclaim that this polyglot, at the time of writing, to be unequivocally the greatest polyglot of all time. Congratulations to all contributors.

Because we’ve finally achieved this self-imposed goal, and because I ended up touching code for damn near all the languages this round, I’ve added a small code snippet from each language along with the code change description. The purpose of these is to provide a place to search for code snippets from the polyglot for research starting point.

For example, if you want to make a change to this 8+9+9+9+9+ you could search for this string, to find that it’s part of Prelude’s code. Then, you may wish to read over the original prelude answer, look at some prelude code changes that have been made, or review the Prelude documentation for alternative solutions.

State of the Test Driver

I copied @SnoringFrog’s Alphuck Transpiler into the Test Driver for viewing the Alphuck code’s in the BrainF*** character set. I found it much easier to debug this way, and I suspect others would as well.

I also added titles to the Extra Information outputs since Alphick’s output is easy to confuse with BF if you’re not familiar with the Bash script.

Lily

]#print(47)#

Nim, we know from this polyglot, uses #[ and ]# for block comments and according to this tip for creating polyglots, Lily uses the same syntax for block comments. So, I wondered if I could find a truthy/falsey abuse to create different outputs, but alas I could not.

Then while browsing Rosettscode.org for unused block comment structures, I came to this post about Nim, and realized it was wrong in its assertion that Nim only has single-line comments. Then I checked Lily’s post and it too failed to mention block comments. (Sadly, I did not have permission to edit the posts.)

Then I went ahead and looked at Nim and Lily’s documentation, just to make sure I wasn’t crazy and I saw an exploitable difference. Nim allows nested comments.

I sat on this knowledge for months, thinking it would be my final addition to the polyglot because it was virtually guaranteed to be available at any time considering its block comment structure was already included, and because it was so under documented.

Over the months, it occurred to me that abusing nested block comments is not a trick that’s not documented in the Tips for Creating Polyglot thread, so I added it. My explanation used a simplified Lily/Nim polyglot as an example, so I’ll refer you to that post if it’s not obvious how I abused this language feature.

CoffeeScript

###;console.log 39

One of Lily’s features is that ### is used to attach a docstring to a function, so if you use this without following it with what Lily views as a function, then Lily will error out. And since ### is CoffeeScript’s block comment, the ### on the INTERCAL line had to change. So the final two # got cut from this line and moved to the line after Lily’s #[ block comment so Lily would view it as a comment instead of a doc string.

Julia

=#print(17)#

By moving the two ## for CoffeeScript, a hole was opened up on the INTERCAL line. The spacing on this line is delicate because Minimal-2D is looping between the beginning of this line and the line two below. So I had to fill the space. The first byte I filled with Julia’s initial block comment command (#=) by moving the = down to fill the space. This move also helped as a partial solve for Labrynth’s final answer, which I talk about later.

BrainF***

+++++[D>+++++++L+++<-]

>+.---.>

The second space opened up by the CoffeeScript move still needed to be filled, and the > at the end of the line above was an easy move. This character set up the proper memory cell for BF so it just needed to go anywhere in the correct order of BF characters, and since there were no BF characters between the old and new location, no problem.

Brain-Flack

({({1})({1}[(0)])}{1}\{1})

In the process of working a different solution, I had an epiphany about old this Brain-Flak code: (\{(\{})(\{}[()])}\{}\{}\{}). I was using \ to escape out { for Japt, but I could put a 1 in each curly brace, to give Japt something to do like I did in the PicoLisp answer. But what would that give me? Trading a \ for any other instruction was at best an even byte swap. But wait… Retina.

Retina had a string of 1s in the same line that were somehow integral to its answer. So I tried moving the 1s over to Brain-Flak’s code to handle Japt and it worked almost entirely.

Thutu, didn’t like having the last \ removed from this snippet, so I left it. I had one fewer 1 in Retina’s code than I required to fill Japt’s braces anyways, so it all worked out rather swimmingly to golf down 5 bytes and produce this: ({({1})({1}[(1)])}{1}\{}).

Later I found I had to swap around 1s because The above tokenized {1} for Incident. So I swapped around the 1s to make ({({1})({1}[(0)])}{1}\{1}).

Modular SNUSP

<$+@+-@@@@=>+<@@@=>+<?#>+.--.

While I was looking at the big line, I decided to look at some other languages. Modular SNUSP is encased in a pair of [], to protect the code from SM/BF. But SM/BF were both already jumping this code because of the [ on line 14. Cut.

Thutu

|/=1/24=x

I never bothered to learn how Thutu works, but I do know that it’s answer was somehow produced in part by |=/=1/24=x=9, so I experimentally, removed various characters and verified that the same results were produced, and found I could get there with less. Golfed!

INTERCAL

[PLEASE,2<-#2DO,2SUB#1<-#52PLEASE,2SUB#2<-#32DOREADOUT,2DOGIVE]

I swapped some Latin FACs for English DOs because it was byte saving, and all the Ds worked safely as Fusion starting points with INTERCAL’s new location.

Hexagony

"(}23!@)"

Here’s where things got messy. I got it in my head that Hexagony’s code module should really, really go inside C/++’s preprocessor directive on line 1. The benefit here is that Hexagony would be permanently be solved because its pointer always starts on line 1 heading to the right, which puts its output command prior to any hexagon wrapping non-sense. And with Cubix in the mix now, providing basically the same headache… Well let’s just do this with 1 language, yeah?

So }23!@ appears in line 1 now, and everything that follows is a consequence of that move. Note that the } is still needed to clear the top value of the stack due to the preceding ( in the final solution.

Pyth

#16

;'[af2.q]

The first problem was moving Pyth’s answer to somewhere else. I spent quite a while looking through Pyth’s documentation for a way to pop the string off the stack or something, before stumbling into the answer. For Pyth, a space preceding any command causes the command to be skipped. This actually works for a full string, like where our Hexagony capsule is residing, so the first x characters of the polyglot became #16 "}23!@", with the 16 here now being Pyth’s answer.

Underload

(22)S

Underload needed the Hexagony capsule to exist within a pair of parenthesis, but if too much of the polyglot went into that first set of parentheses Underload would bomb out. Also, our last few solutions had an open ended ( on line 1, which was preceded by a \ for Retina to escape it out of consideration. (Retina didn’t like the imbalanced ().) But now, this solution didn’t work for Retina if there was already a pair of () in the line. The new solution opens and closes 2 sets of parenthesis on line 1 to get around these problems. Fortunately Underload didn’t complain before a new set of parenthesis could be opened on line 2.

Meanwhile, inserting more text in line 1 prior to the v causes line 2 to require a bunch of filler characters prior to its >, which is the Befunge code path. The largest piece of lose code that could fill the hole was Underloads answer statement (22)S which got moved earlier in line 2 along with some related Alphuck Ps that needed to appear prior to s’s for its jump. (More on Alphuck later.)

Trigger

GkGGZ

Z222999

Trigger’s jump code got pushed out of line 2 by Underload’s shift, so it had to go somewhere and the earlier the better. The Japt string '[af2.q]’ in line 1 turned out to be a well-hidden location, so I plopped Trigger jump code there after Pyth quit, making '[af2.q] GkGGZ’.

You may notice that the letters in the jump code got changed again, this is partly because I wanted to leverage the space for a polyglot unique Incident jump token, and partly because of a problem caused by… wait never mind. I just uppercased the Gs for no good reason. Ok, whatever.

SMBF

<]+<[.>-]>[

With characters spaces to fill prior to the > on line 2, I moved the [ back in the line to help fill the hole. You might think as I did that it might be possible to golf off this character all together, as well as the ] on line 1, but this causes Retina to get grumpy, as it did with Underload. And even if you think about throwing a \ prior to [ might fix Retina, you would be right, but it would cause 05AB1E to fail in a way that I presume cannot be fixed with a zero byte budget. So I didn’t bother.

Turtlèd

#)"14"

I managed a line 1 character order that didn’t necessitate the # # therein. So the turtle no longer pokes his head out of the shell before finding “14”.

Labrynth

# >36!@

The maze got kinda messed up by all the shifts for Hexagony. The biggest problem was that the old solution relied on the second character in the polyglot being a space (aka maze wall). Now the pointer turns right once it passes into the 1 on line 1, which was a problem because the / on line 2 set the top of the stack to 0, which caused the pointer to really want to go straight.

Trial and error montage

This got solved by putting a > in the path of the pointer after the /, which is an instruction to shift all of row 3 one cell to the right. This puts the pointer in column 3 as it continues its zero valued straight path to the > in >36!@ which again shifts; this time row 4. From this point, the pointer turns to head down line 4 which from that point forward is a 1 way trip to the end of the maze.

@SnoringFrog made a gif of Labrynth's code path to help someone with an answer, and I thought it was cool and helpful enough that it should be added here.

enter image description here

Japt

`|1|6$`

I golfed some other bytes off of line 1. It was all trial and error and I have no idea how Japt works for the most part. I guess I can say that in the # near the end of line 1 causes Japt to take the ascii value of the ). Most everything else is a mystery.

Minimal-2D

#=<xR+++++[D>+++++++L

#Rx%>~~~+ +~*ttt*.x

#D>xU/-<+++Lnd

#R+.----\).>]|

Part of the line 1 refactor was to place the D early enough in the line to minimize the amount of empty space thrown into line 8, where Minimal 2-D catches the code path From the D to L. I ended up being able to place the \D just after the v in line 1, which ended up being the same column it started in, so I didn’t have to touch line 8.

Befunge

7 7*,;68*,@

The space between the 7’s on line 2 is a spacing shift for Minimal-2D’s D on line 1 so that Fission doesn’t pass through a character. The 7 that Fission would otherwise pass through here doesn’t actually cause a problems, but the space is part of White space’s answer, so it needs to appear somewhere on the line, and this seemed like a better place than most.

Befunge-98

>7 7*,;68*,@;'1,@

For some reason the Hexagony capsule gave a problem for Befung-98. I believe it was producing non-deterministic results for a while there. I don’t know what the issue was, because I went back and looked at an old solution for inspiration and saw that there was a @ before it quit in prior solutions, so I tried it and it worked.

Reticular

;#:p'34'\

Reticular, Haystack, and Reng, which all wrap around the polyglot when they hit the first / on line 1, had to be redone because we’re wrapping on a later column than in previous solutions. Now the code path goes through the 6 on the final line, which gets buried in a stack values for these languages, and continues to the \ on the next to last line which catches the code path, and pushes these languages’ pointers to the left.

Reticular was the problem child of the bunch because it had a command in the Hexagony capsule, which it traversed prior to wrapping, that caused the old solution to break on Reng’s code. I solved this by throwing Reticular’s code first in the order.

Reng

~nJ

The ;, which terminated Reticular, gave Reng some problems because it views the command as a reflector. So Reng gets a # jump command to skip past the ;. But Reticular threw an error on the #, so I tossed in a preceding : to indicate that the following # was to be pushed onto the stack as a string.

Haystack

|o51

Haystack’s old solution was too long, unless I was going to wrap up to another line, but I no longer needed to use the old solution because I was terminating Reticular earlier, so I reverted to the old solution of outputting a string rather than ascii values, which was shorter, allowing the 3 languages to exactly fit in one line.

Minkolang

$$$

#<.>"3"O.

The change to remove the space before the first number in line 1 caused Minkolang to fall through time a in column 4. The upshot of this was I could golf out a bunch of the junk that had to be thrown into Minkolang’s code line because it previously couldn’t start with a #. The . in the final solution is both needed as a placeholder, and to detokenize .>.

Incident

kGkG0l0v0@O6O4/1k1k0l(0i0jx0h0h1d111x0eU0bx0b0o1d0b0e0e00m1d0i0fx0g0n0n11x0o0n0cx0c0o0f0c0gx0g0f0h0j0j0i0001k10vx0v0l11111100^_

^_^_

I think @SnoringFrog, during his week of all-nighters and fantastic code golfing, changed the incident token 0e to 0ee, presumably to make Cubix work. I found I could once again set this token back to 0e to save a few bytes.

I also went through the polyglot and re-tokenized any Incident tokens that were littered about. I ended up putting just a few back. One I mentioned is the . in <.>. Another is the ! in [!PPP on line 2. The nd in +Lnd is a detokenizing string as well that I couldn’t otherwise fit into a place holding gap.

PicoLisp

}#(prin 45)(bye)

The location of PicoLisp’s instructions became kind of a problem because Prelude’s parenthesis budget got shifted by Underload’s change. So I just moved PicoLisp’s answer. Putting all these parenthesis so close to column 1 was just asking for trouble anyway. Code is now in the Python line, which is safer.

Alphuck

ssseemeePaeueewuuweeeeeeeeeeCisajjapppp

This is my first time working with Alphuck and it is surprising how much it doesn’t feel like BrainF***. Just the fact that all the characters show up all the time makes the language much harder to work with. And it’s much more difficult to read. Anyways, the PicoLisp move changed the [] balance (speaking in BF terms) so I had to add back some s’ in the evil line and the last line.

Prelude

46(8+9+9+9+9+=!)

Prelude had all kinds of rearrangements due to the Underload move. But these we’re mostly just the spacing shifts we’ve all become accustomed to. The one large change was to move the ) now seen in #R+.----\).>]| from the end of the line above. To leave it in its old home required too many spaces. Experimentation showed there was a happy home a few columns left of its original spot and the the characters to the left were all rigidly incorporated into the Minimal-2D solution. So the next best move was to go down a line where Minimal-2D was more flexible and Underload was still happy.

Retina

({({1})({1}[(0)])}{1}\{1})

|1|6

Retina had a small problem with the Prelude move discussed above however. The line change put the hanging ) on a cares-about-symbol-balance line, so preceding \ was thrown in to placate Retina. We were still byte saving from the number of spaces Prelude needed on the line above, so we were good with this result.

Cubix

@O6O4/

While I loved the elegance of the Cubix Placement in the last answer it was fragile, and yeah I broke it with all this stuff I did. So I stepped through the Cubix interpreter to find a good place to catch the code path and ended up hooking it in the Incident/While line, which is a pretty good place to catch it because the Cubix module could mostly slide freely throughout the line. The only catch was that you had to be very careful not to place Cubix inside an incident token. All the incident tokens in this space start with either a 1 or a 0 and are followed by a letter, other than x. x in this space appears to be a de-tokenizer. Fortunately Cubix slipped in between tokens without a spacer.

Whitespace

Or

␉␉␉␉

There were a few hidden tabs left over from earlier Whitespace solutions that were still needed as whitespace for whatever other languages were in the region. So I swapped these out for plain old spaces, just for the convenience of reading.

And that was the last of my code changes. Here are the few languages I didn’t touch.

evil

meePaeueewuuw

Cardinal

x%>~~~+ +~*ttt*.x

C

#define z sizeof'c'-1?"38":"37"

#include<stdio.h>

main( )/*/

#()`#`\'*/{puts(z );}/*' ``

C++

#define z sizeof'c'-1?"38":"37"

#include<stdio.h>

main( )/*/

#()`#`\'*/{puts(z );}/*' ``

Rail

$'main'//

#-3o4o#

Python 2

print( (eval ("1\x2f2")and(9)or(13))-(0and 4)^1<<(65)>>(62))

Python 3

print( (eval ("1\x2f2")and(9)or(13))-(0and 4)^1<<(65)>>(62))

Ruby

print( (eval ("1\x2f2")and(9)or(13))-(0and 4)^1<<(65)>>(62))

Perl

print( (eval ("1\x2f2")and(9)or(13))-(0and 4)^1<<(65)>>(62))

__DATA__=1#//

Perl 6

#>27.say#

05AB1E

"26

Pip

''25

Whirl

0l0v0@O6O4/1k1k0l(0i0jx0h0h1d111x0eU0bx0b0o1d0b0e0e00m1d0i0fx0g0n0n11x0o0n0cx0c0o0f0c0gx0g0f0h0j0j0i0001k10vx0v0l11111100

Fission

#.\."12"__*

V

dggi2

Or

␛ dggi2␛

><>

;n4

Nim

]#echo 21#

Going Forward

While trying to prove to my insistent brain that Octave was an impossible addition, I instead proved that actually will fit in here. It requires a bit of comfort with tricking Japt around curly braces and a rather interesting 3 language solve, but it is possible.

The polyglot currently executes in Objective-C (clang) to produce 38 (the C answer). I’ve looked for a language native method for differentiating from C, but haven’t had any luck. Clang has pre-defined macros like TIME that are not used in the C/C++ compiler we’re so far using. But I’d prefer to find a language native method of differentiating Objective-C is possible. Any ideas?

And along those lines, I think we’re at a point where we’re soliciting ideas from the community. I know my idea bank is running low, so if you have any suggestions, please leave a comment.

Also, a special shout out to @WheatWizard for suggesting Glypho as a possible addition as well. I haven’t looked too deeply at it yet, but I am intrigued.

\$\endgroup\$
4
  • \$\begingroup\$ Oh wow, I just realised how the Thutu works now. It's inputting EOF from stdin, and then misinterpreting that EOF as a command, which just happens to be the command to exit the program. (Meanwhile, the INTERCAL appears to be crashing with an error after printing output; there's likely a missing GIVE UP statement. That probably needs to be fixed.) \$\endgroup\$
    – user62131
    Commented Mar 17, 2017 at 22:28
  • 1
    \$\begingroup\$ Oh, and on the subject of Objective-C, I believe it's a strict superset of C (i.e. all C programs will run unchanged in Objective-C). Thus, adding it into the polyglot is going to have to rely on implementation-specific details somehow (such as evaluation order, which isn't specified in many cases in C); it's maybe not impossible, but it's going to be harder than normal. Perhaps we should create a chatroom for discussing polyglot ideas? Doing it in comments is awkward. \$\endgroup\$
    – user62131
    Commented Mar 17, 2017 at 22:36
  • \$\begingroup\$ @ais523 Interesting that INTERCAL gave an exit code of zero in the test driver. Do we have a compiler discrepancy with Tio? I think a polyglot chat room is an excellent idea. \$\endgroup\$
    – Chance
    Commented Mar 17, 2017 at 22:56
  • \$\begingroup\$ It's a syntax error, which has error code ICL000I. C-INTERCAL returns the error number as the exit code; it's just that 0 for a syntax error is indistinguishable from 0 for success. As for the chat room, let's discuss things here. \$\endgroup\$
    – user62131
    Commented Mar 17, 2017 at 23:19
12
\$\begingroup\$

12. Fission (110 bytes)

Just adding yet another 2d lang... Streak of 3 2d-langs in a row, let's keep it moving folks!

#v;2^0;7||"<+0+0+0+<*!2'!1'L;n4
#v0#_q@
#>3N.
#|\w*
#8  ^1b0<
#|
#M`
print(None and 9or 1/2and 1or 5)
#jd5ki2

This prints 1 in Python 3, 2 in Vim, 3 in Minkolang, 4 in <><, 5 in Python 2, 6 in SMBF, 7 in Japt, 8 in Retina, 9 in Perl, 10 in Befunge, 11 in Befunge-98, and 12 in Fission.

Try it online!

Explanation

The only important piece of code is the first line

                These are the important bits
                    >------<
#v;2^0;7||"<+0+0+0+<*!2'!1'L;n4
                           ^
                   we start here by creating an atom moving Left
           (I could not use R for Right since that means Replace in Vim)

                       1'          sets the atom's mass to the ASCII value of '1'
                      !            outputs the atom's mass (as a character) 
                    2'             sets the atom's mass to the ASCII value of '2'
                   !               outputs it
                  *                program terminates

Next...

If Fission is causing trouble, remember, you can move the Fission code anywhere you want, since the start of the program is only identified by the commands that create atoms, and the program ends whenever the atoms are destroyed.

You can also change the atom's start direction to suit your needs, R for Right (but Vim will interpret that as Replace), U for Up, D for Down (or Deletes entire line in Vim, can be useful).

\$\endgroup\$
4
  • \$\begingroup\$ This answer doesn't work with the Befunge93 answer, it only produces a 0 not 10. \$\endgroup\$ Commented Dec 7, 2016 at 8:54
  • 1
    \$\begingroup\$ @Tealpelican Works for me. Did you remember the ESC character between j and d on the last line? See the TIO link. \$\endgroup\$
    – Zgarb
    Commented Dec 7, 2016 at 8:59
  • \$\begingroup\$ @Tealpelican tio.run/nexus/… \$\endgroup\$
    – user41805
    Commented Dec 7, 2016 at 9:00
  • 1
    \$\begingroup\$ Yeah my bad, for some reason chrome was removing it for me. \$\endgroup\$ Commented Dec 7, 2016 at 9:23
12
\$\begingroup\$

34. Rail, 549 bytes

#v`16/"<"6/b.q@"(: ::Q):  ␉␉␉␉ :(22)S#;n4"14"
#>3N6@15o|>␉^*ttt*~++~~~%
#= >␉1#v#v0l0mx01k1k0l0ix0jx0h0h1d111x0ex0bx0b0o1d0b0e0e00x1d0i0fx0g0n0n11x0o0n0cx0c0o0f0c0gx0g0f0h0j0j0i0001k10mx0m0l11111100(^_)
#[␉
#`<`|
print((eval("1\x2f2")and(9)or(13 ))-(0and 4)^(1)<<(65)>>62)or'(\{(\{})(\{}[()])}\{}\{}\{}) '#46(8+9+9+9+9+=!)#1111|=/=1/24=x=9[[<$+@+-@@@@=>+<@@@=>+<?#>+.--.]]/
__DATA__=1#//
#.\."12"␉;
""""#//
=begin␉//
$'main'//
#-3o4o␉
=end   #//
"""#"#//
#]#echo 21 #//=#print( 17)
#   +/Jn~
#8␛dggi2␛`␉|1|6$//''25  #>say 27#$nd^_^_.Q222999/+23!@"26

As usual, is a literal tab, is a literal ESC character.

Rundown

This program prints 34 in Rail, 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Try them online!

For the languages that aren't supported by the above test driver:

  • V can no longer test the full polyglot in Tio because it takes too long to run now. But I have added a test to the above test driver to run all code after ␛dgg in the polyglot since these V commands essentially invalidate all prior code.
  • Reng can be tested here, and outputs 19 as expected.
  • Modular SNUSP can be tested here, and outputs 31 as expected.
  • Incident was confirmed to output 33 by ais523.

Explanation

I too have been planning! I have long been stymied by the limitation of starting every line with a # or exposing the code to Python, Ruby, and Perl. Well no more! I decided to rip a literal hole in the code. (I use the term literal figuratively.) We're now including a literal string from the perspective of the scripting languages, so that we can begin lines with characters other than # which Rail, takes advantage of.

Kill Perl

The first problem was that Perl 5 didn't want to execute when there was an unsigned string, so after some experimentation, I settled on killing Perl 5's execution after the big print statement. This is handled with __DATA__=1. This is followed by # to comment out Thutu's //. You'll see these in the solution wherever there is a line that doesn't start with a #. They seemed to make Thutu happy.

The DATA in this statement created two other consequences as well. First, we were using T as our Trigger jump label, so that got changed to a quirky Q in first line's : ::Q and the last line's Q222999. Second, Fission treats UDL and R as starting points and the D in DATA kicked off another fission reaction heading in the down direction. So, I had to kill the 3rd line's Fission statement R"12"; and create the line #.\."12"␉; to make sure the reactor didn't melt down. The \ redirects Fission's code path along the line and the .'s are just for spacing.

Let's Get Literal

Both Python flavors use """ to denote the beginning and end of literal strings. Ruby naively thinks " denotes a literal string and has no problem with multiple literal strings bumping up against each other and not being used. But Ruby, Perl, and Pip just could not all agree on when the stuff in between the starting and ending lines for the literal string where actually strings. I settled on letting Pip and Python agree and letting Ruby think what's in between is code. So, this line """"#// and this line """#"#// begin and end the string from Python's perspective. Ruby ended up going to a multi-line comment syntax in the middle of all this business with the =begin // and =end #// statements.

Reng Around the Rosie

With all the extra #'s floating around, Reng had all kinds of problems, so it's code got moved to the bottom and I golf'd out the extra x in the Whirl-Incident capsule. At this point, I believe the only 2D lang to traverse the literal string's space is Cardinal and it can be moved into and bound within the literal zone, but I didn't have the byte count to accomplish this today. Next time.

Ride The Rail

Rail starts at the $ in $'main'// and continues heading right on the next line starting with the -in #-3o4o␉. The $'main'// line is pretty flexible for inter mixing other code, so it's a good place to add onto.

The Literal Zone

New lines can be added now above or below the Rail code with a few stipulations:

  • Lines need to be added in pairs for Retina to keep working.
  • Lines not starting with a # are exposed to Thutu but have generally worked for me if I end the statement with //
  • Code before a # is still exposed to Brain-Flak, so (){}[] and <> may cause problems.
  • Every other line should have a literal tab for Whitespace. Or, if this pattern has to be broken, a triple space will usually work.

Incidental Edit

Incident required a few alterations. $ and nd turned out to be new tokens after the refactor, so I added an extra set of both of these tokens near the end so they no longer counted. The Hexagony module needed to be nearer the end than Incident's final jump token wanted to be placed as a copy of the end of the module, so I had replaced the final jump token with ^_ which all appear before hexagony. Finally, I believe a [ got pushed to the other side of the bulk of incident's code Incident's which I believe caused the center token to be changed. AIS523 pointed out that an extra set could probably be added safely around the Modular SNUSP code, which worked out nicely and let us meet the byte count, just barely.

\$\endgroup\$
9
  • \$\begingroup\$ Fails in Incident due to adding a lot of new strings that are repeated three times after the Incident code; the control flow in the Incident program is still correct, but there's no longer an 0o in the centre of the program (the centre of the program in tokens, as seen by Incident, comes rather later). This seems fixable, however. \$\endgroup\$
    – user62131
    Commented Jan 18, 2017 at 1:16
  • \$\begingroup\$ Dangit, I was going to add Cubix as 34, which would only require a carefully placed QO@... \$\endgroup\$ Commented Jan 18, 2017 at 1:20
  • 1
    \$\begingroup\$ It still doesn't work, due to more stray tokens; the easiest fix I've found is to add an additional [ and ] (each of which currently appears three times). I placed them around the SNUSP code; no idea if that breaks anything else. \$\endgroup\$
    – user62131
    Commented Jan 18, 2017 at 15:50
  • 1
    \$\begingroup\$ @ais523 Thanks again. That looked like a good fix for everything else. I had to reduce the second Incident jump code to 2 characters to meet the byte limit. We might need something that identifies Incident's tokens and specifically the center token for testing purposes. \$\endgroup\$
    – Chance
    Commented Jan 18, 2017 at 17:20
  • 2
    \$\begingroup\$ I can confirm that this works in Incident now. I agree that an Incident syntax highlighter would be useful here (there's one as part of the Incident distribution, but that's not really usable online). I know Martin Ender was considering starting a challenge about writing one; I wonder what the progress on that is like. \$\endgroup\$
    – user62131
    Commented Jan 18, 2017 at 18:11
12
\$\begingroup\$

56. dc, 1286 bytes

#16  "(}23!@)(" 3//*v\D@;'[af2.qc]'#)"14";n4
#/*` PkPPX (22)S"[!(>7 7*,;68*,@;'1,@␉␉␉␉ P''53'S^'q
#>␉
# >36!@␉
#`<`
#<]+<[.>-]>[
#{
#z}
#
#=x<R+++++[D>+++++++EAL+++<-][pPLEASE,2<-#2DO,2SUB#1<-#52DO,2SUB#2<-#32DOREADOUT,2PLEASEGIVEUPFACiiipsddsdoh]>+.-- -. >][4O6O@
#x%+>+=ttt Z_*.
#D>xU/-<+++L
#R+.----\).>]|
#[#[(}2}20l0v0x1k1kMoOMoOMoOMoOMOO0l0ix0jor0h0h1d111x0eU0yx0y0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k10vx0v0l111111^_)0
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.|
#
[ ']56pq[' ];#//
'(p(x0 \';case $argv[1] in *1*)echo 50;;*)echo 54;;esac;exit;0';print((eval("2\x2f5")and(9)or(13))-(0and 4)^1<<(65)>>(62))or"'x"or'\{0}1{0}1{0}1{0}([9]<((((((1)(1)(1))){1}1{1}))0{1}1{1})1>0)5{(<{1}(({1}){1})>0)}{0}({1}(1))'#}#(prin 45)(bye)|/=1/24=x046(8+9+9+9+9+=!)/
__DATA__=1#"'x"//
#.;R"12"'
###;console.log 39
""""#//
=begin //
#sseeeemPaeueewuuweeeeeeeeeeCisajjap*///;.int 2298589328,898451655,12,178790,1018168591,84934449,12597/*
#define p sizeof'p'-1?"38":"37"
#include<stdio.h>
main ( )/*/
#
#"`#"\'*/{puts (p);}/*'"`"
/*
<>{#65}//
#}
disp 49#//
#{
1}<>//
$'main'//
#-3o4o#$$$
#<R>"3"O.
=end #//
"""#"#//
#}
#s|o51~nJ;#:p'34'\=#print (17)#>27.say#]#print(47)#]#echo 21
#sss8␛dggi2␛ `|1|6$//''25  16*///^_^_X222999"26

is a literal tab, a literal ESC character; Stack Exchange would mangle the program otherwise. I recommend copying the program from the "input" box of the TIO link below, if you want to work on it.

Try them online!

VIP score (Versatile Integer Printer): .007322 (to improve, next entry should be no more than 1355 bytes)

Rundown

This program prints 56 in dc, 55 in Brain-Flak Classic, 54 in Zsh, 53 in Shove, 52 in COW, 51 in Assembly, 50 in Bash, 49 in Octave, 48 in Deadfish~, 47 in Lily, 46 in Cubix, 45 in PicoLisp, 44 in alphuck, 43 in reticular, 42 in evil, 41 in brainfuck, 40 in Minimal-2D, 39 in CoffeeScript, 38 in C, 37 in C++, 36 in Labyrinth, 35 in INTERCAL, 34 in Rail, 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Most of the languages (including the most recent addition, dc) were tested via the use of the test driver on TIO, linked above.

  • Reng can be tested to output 19 here.

  • Modular SNUSP can be tested to output 31 here.

  • Incident was verified to test 33 by running the official interpreter locally.

  • Deadfish~ can be tested to output 48 using this interpreter. Note that Deadfish~ takes the polyglot to be fed on stdin, and prints a number of >> prompts to standard output, which are an unavoidable consequence of running any Deadfish~ program; the remaining output is the output of the program.

Explanation

dc

dc is a fairly old programming language. It originally started as a calculator program, then ended up being given a bunch of stack manipulation commands, and the ability to place functions on the stack, making it Turing complete (in a way rather close to Underload). It was originally intended as a practical language – in fact, it was the first programming language that could be run on the PDP-11 machine that was later used to develop UNIX – but more recently, many people would consider it an esolang. It's also a fairly popular choice for answering challenges here on PPCG, despite being fairly obscure nowadays.

In this case, there are a few relevant properties of dc that make it easy to work into a polyglot: # comments; […] string literals; and a quit command q. So the program that runs is simply […]56pq, i.e. push a string literal (that we never look at), print 56, then quit.

bash, zsh, Perl, Python, Ruby

The dc line is a new line, and it comes before the existing scripting language code. As such, it needs to be harmless in all those languages.

In Perl, Python, and Ruby, […] is a list literal. Placing a string literal inside this allows us to hide the code from these languages, while allowing dc to see it. Single quotes are much better for this purpose than double quotes (single quotes are only used in the polyglot at present to skip small sections of code, whereas several languages have almost the whole thing in a double-quoted literal). We also need a semicolon to discard the list literal when we're done.

In bash and zsh, [ is a command that evaluates expressions (and for balance's sake, uses ] to terminate the command rather than ;). If the first parameter seen doesn't start with - (it doesn't), this is a test for nonemptiness, which is great as we can meaningfully apply it to pretty much any string.

Thutu

Adding a new line that doesn't start with a # means it need to be made Thutu-safe. Appending // is the typical way to do this, and works. I also needed to add a # to hide it from the scripting languages.

Retina

Retina ascribes a different meaning to odd lines and to even lines. I added a line with just # in order to get the parity right.

Brainf***, self-modifying and otherwise

dc has no need to reopen a string literal after its q. However, square brackets need to match for another reason: they're loops in Brainf***. We can fix this by putting in an opening square bracket in at the point just between the q (where dc stops reading) and the ' (where the scripting languages start).

Alphuck

p, dc's print instruction, starts a loop in Alphuck. I changed a p on the next line to an x in order to rebalance the Alphuck code.

Incident

As usual. The rebalancing here was accomplished by adding a filler character to the Modular SNUSP line to break up one copy of the #< token (this rebalance was more awkward than usual as I needed to break up a token which had copies before the main body of the Incident code).

Summary

This was actually a really easy add (as can be seen by the small size increase). The difference in literal syntax between dc and the scripting languages made it possible to split it off early and safely (this is the same technique that's normally used to include Lua in polyglots, but Lua doesn't have # comments; dc does). A lot of languages needed changing, but most of the changes were really minor.

\$\endgroup\$
12
\$\begingroup\$

61. S.I.L.O.S., 1445 bytes

#16  "(}23!@)(" 3//*v\D;'[af2.qc]PkPPX'#)"14";n4
#/*0|7//`"`   ['][!(>77*,;68*,@;'1,@1␉0␉␉11)(22)S␉(1 P''53'S^'q
#>␉
# 36!@␉`
#
#
#`<`
#<]+<[.>-]>[
#{
#z}
#
#=x<R+++++[D>+++++++  L+++<-][pPLEASE,2<-#2DO,2SUB#1<-#52DO,2SUB#2<-#32DOREADOUT,2PLEASEGIVEUPFACiiipsddsdoh]>+.-- -. >][4O6O@
#x%+>+=ttt Z_*.
#D>xU/-<+++L
#R+.----\).>]|
#[#[(}2}20l0v0x1k1kMoOMoOMoOMoOMOO0l0ix0jor0h0h1d111x0eU0yx0y0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k10vx0v0l111111^_00)
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.|
#
[ "]56p26q[puts 59][exit]" ,'\[' ];#//
'(((p\';a=a;case $argv[1]+${a:u} in *1*)echo 50;;*A)echo 54;;*)echo 58;;esac;exit;';print((eval("1\x2f2")and 9or 13)-(0and 4)^1<<(65)>>62)or"'x"or'{}{}{}{}({}<(((((()()())){}{})){}{})>)\{(<{}(( {}){})>)}{}({}()) li ha '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("'3)3)3)"|/=1/24=x'/
__DATA__=1#"'x"//
#.;R"12"'
###;console.log +39
""""#//
=begin //
#sseeeemPaeueewuuweeeeeeeeeeCisajjap*///;.int 2298589328,898451655,12,178790,1018168591,84934449,12597/*
#define p sizeof'p'-1?"38":"37"
#include<stdio.h>
main ( )/*/
#*/{puts(p);}/* 
#
/*
1=61 //
printInt 1//
<>{//
#}
disp 49#//
#{
}<>//
$'main'//
#-3o4o#$$$
#<R>"3"O.s
=end #//
"""#"#//
#}
#s|o51~nJ;#:p'34'\=#print (17)#>27.say#]#print(47)#]#echo 21# xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi ax
#sss8␛dggi2␛`|$//''25  16*///~-<~-<~-<<<~-^_^_X2229996

Try it Online

VIP score (Versatile Integer Printer): .006366 (to improve, next entry should be no more than 1517 bytes)

Rundown

This program prints 61 in S.I.L.O.S, 60 in Moorhens 2.0, 59 in Tcl, 58 in Ksh, 57 in Wise, 56 in dc, 55 in Brain-Flak Classic, 54 in Zsh, 53 in Shove, 52 in COW, 51 in Assembly, 50 in Bash, 49 in Octave, 48 in Deadfish~, 47 in Lily, 46 in Cubix, 45 in PicoLisp, 44 in alphuck, 43 in reticular, 42 in evil, 41 in brainfuck, 40 in Minimal-2D, 39 in CoffeeScript, 38 in C, 37 in C++, 36 in Labyrinth, 35 in INTERCAL, 34 in Rail, 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Most of the languages are tested by the test driver shown above.

  • Reng can be tested to output 19 here.

  • Modular SNUSP can be tested to output 31 here.

  • This has been tested to working Incident by ais523 on the official interpreter.

  • Deadfish~ was can be tested to output 48 locally, using this interpreter. Note that Deadfish~ takes the polyglot to be fed on stdin, but and prints a number of >> prompts to standard output, which are n unavoidable consequence of running any Deadfish~ program.

  • Moorhens 2.0 can be tested to output 60 using this interpreter.

S.I.L.O.S.

At @RohanJhunjhunwala’s suggestion, I looked at adding S.I.L.O.S.. It was a short investigation, because I only had to put a line that said print 61 in somewhere, and it worked. The only problem was Thutu, which required a trailing // on each line that didn’t start with a #, and when I added this to the end of the print statement, the output became 61//. So I poked around with the documentation for a minute, and found this:

1 = 5

printInt 1

//prints five

Well that’s easy. 1 = 61 // and printInt 1// gets us past Thutu and virtually done. Just a couple tweaks.

Alphuck

S.I.L.O.S. added a p, which is a loop initializer is Alphuck, so I had to add the matching terminator to compile. That Terminator, s, got placed at the end of the Minkolang line #<R>"3"O.s

Incident

Incident was slightly imbalanced, so I removed some detokenizing bits from @ais523’s last answer in a guess and check fashion. Now, #*/{puts(p);}/* no longer has a trailing space, and console.log 39 no longer has a +.

Edit: Okay, I didn't need to actually do anything with incident, so I just undid all the above detokenizations.

Test Driver Update

In the past, I've found myself failing to notice that a language was returning a number, but the wrong one. I've finally gotten around to addressing the problem and added a test result to the output of the test driver. so now, when Retina returns 7 instead of 8, the test will be flagged as a fail.

I also did a little formatting for alignment. Languages that aren't on Tio will now have a place holding X's where their numeric result is expected and single digit results will have a place holding space inserted as well.

\$\endgroup\$
7
  • \$\begingroup\$ Wow +1 because I didn't think anyone would come up with such a clever abuse of the use of integers as variables!! \$\endgroup\$ Commented May 3, 2017 at 22:37
  • \$\begingroup\$ Moorhens 2.0 works \$\endgroup\$
    – Wheat Wizard
    Commented May 3, 2017 at 23:32
  • \$\begingroup\$ @RohanJhunjhunwala Did you patch my hack? :P This polyglot solution stopped working. tio.run/nexus/silos#@29oa2aooK/PVVCUmVfimVeiYKiv//8/AA \$\endgroup\$
    – Chance
    Commented May 18, 2017 at 20:40
  • 1
    \$\begingroup\$ Unfortunately, the latest change with expression parsing is broken, however this works \$\endgroup\$ Commented May 18, 2017 at 21:05
  • \$\begingroup\$ @RohanJhunjhunwala Oh, thanks! That's an easy swap. \$\endgroup\$
    – Chance
    Commented May 18, 2017 at 21:37
12
\$\begingroup\$

72. Fortran (GFortran), 1948 bytes

#16  "}(o+?23!@- "/*\Dv;'[af2.q]PkPPX)\('#CO"14";*/
#/*0|7//```"`  )[-'][(>77*,;68*,@;'1,@1011)(22)S ␉\4n;␉␉␉(1P''53'S^'????!?!??!??!!!!???!?!??!!?!?!!!!!?!!!!?????!????????????????????!) (qx
#>␉
# 36!@␉`
#
#_>++++.>++++++::@---x---.+?
#`<`
#<]}}+<[<.>>-]>[
#{
#x}
#2""/*\*
#=x<R+++++[D>+++++++qL+++<-][pPLEASE,2<-#2FAC,2SUB#1<-#52FAC,2SUB#2<-#32FACREADOUT,2PLEASEGIVEUPFACiiipsddsdoh]>@@+.---@.>][
#x%+>+=ttt Z_*.ar
#D>xU/-<+++L
#R+.----\).>]|
#[#[(?2?20l0v01k1kMoOMoOMoOMoOMOO0l0ix0jor0h0h1d@O6O4111x0eU0y0yx0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k1x0vx0v0l111111^_0)0
[ "]56p26q[puts 59][exit]" ,'\['];#/s\\/;print"24";exit}}__DATA__/
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.
'((( p\';a=a;case $argv[1]+${a:u} in  *1*)echo 50;;*A)echo 54;;*)echo 58;;esac;exit;';print((eval("1\x2f 2")and 9or 13<<(65)>>65or 68)-(0and 4)^1<<(65)>>62)or"'x"or' {}{}{}{}({}<(((((()()())){}{})){}{})>){(<{}(({}5){})>)}{}({}())wWWWwWWWWwvwWWwWWWwvwWWWwWWWWWWWWwWWWWwWWWWWWWwWWWWWWWWwwwwvwWWWwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwvwWW li ha '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("3'3)))"'
__DATA__=1#"'x"
#.;R"12"'
###;console.log 39
""""
=begin
<>{
utpb now 70 dollar off!
ai
utpb has been selling out worldwide!
ai fir at fir
#sseeeemPaeueewuuweeeeeeeeeeCis:ajjap*/
#if 0
.int 2298589328,898451655,12,178790,1018168591,84934449,12597
#endif//*
#1""//*
#define u8 "38\0"
#define p sizeof'p'-1?u8"67":"37"
#include<stdio.h> 
main (  )  {puts(p);}//*/
#if 0
#endif//*
/*/
print'("72")';end;
#if 0
#endif//* rk:start | print: "69" rk:end
print 61
#}
disp 49;
#{
}<>
$'main'3
#-3o4o#$$$
#<T>"3"O.
=end
"""#"
#}
#s|o51~nJ;#:p'34'3\=#print(17)#>27.say#]#print (47)#]#echo 21# xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi os fwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwvm
#s8␛dggi2␛`|$// '' 25  16*///~-<~-<~-<<<~-COprint("65")#ssss^_^_X2229996#

VIP score (Versatile Integer Printer): .005219 (to improve, next entry should be no more than 2030 bytes)

This program prints 72 in Fortran, 71 in what, 70 in Commercial, 69 in rk-lang, 68 in Python, 67 in C11, 66 in Surface, 65 in ALGOL 68, 64 in Agony, 63 in Brian & Chuck, 62 in Grass, 61 in S.I.L.O.S, 60 in Moorhens 2.0, 59 in Tcl, 58 in Ksh, 57 in Wise, 56 in dc, 55 in Brain-Flak Classic, 54 in Zsh, 53 in Shove, 52 in COW, 51 in Assembly, 50 in Bash, 49 in Octave, 48 in Deadfish~, 47 in Lily, 46 in Cubix, 45 in PicoLisp, 44 in alphuck, 43 in reticular, 42 in evil, 41 in brainfuck, 40 in Minimal-2D, 39 in CoffeeScript, 38 in C99, 37 in C++, 36 in Labyrinth, 35 in INTERCAL, 34 in Rail, 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Try it online!

  • Reng can be tested to output 19 here.
  • Modular SNUSP can be tested to output 31 here.
  • Incident tested to output 33 via manual balancing of tokens.
  • Deadfish~ and Moorhens were tested by WheatWizard.
  • Surface can be tested to output 66 here.
  • Japt was updated in Tio to fix the parsing error we've been exploiting, so it must be tested individually here.

Explanation

Fortran

Fortran is another old and famous language we're able to add to the polyglot. It’s original spec appeared in 1956 which is a just prior to ALGOL 58, which I believe makes this the oldest high-level language we’ve added. Assembly is, I believe, the oldest overall.

Of course we’re not using the original compiler, because that wouldn’t work. We’re using GCC’s Gfortran interpreter and we're using the 08 version of Fortran, although the Fortran code we’re using is compatible with other versions, it’s just the one I arbitrarily picked.

The biggest problem with adding Fortran was that the language doesn’t have a block comment, which is the #1 trick for hiding the polyglot. But, Gfortran happened to have C style preprocessor directives if you’re file extension is among the following (.fpp, .FPP, .F, .FOR, .FTN, .F90, .F95, .F03 or .F08), which is the track I took. I happen to be using F08.

I had originally planned to hide the polyglot in a non-executing preprocessor if block, but the lines contained therein continued to be read by the pre-processor unfavorably. But I stumbled into the realization that C-style comments appearing within pre-processor directives are treated as comments. After some experimentation I found that #endif//* entered a comment block for Fortran, but not the C family, nor asm. This appears to be because the GFortran supports C style block comments, but not line comments. Our asm interpreter naturally treats lines starting with a # (that it doesn’t recognize as a preprocessor directive) as a comment.

Once C comments were handled, I just needed to put in the following line in a space only read by Fortran print'("72")';end; and we made a successful polyglot.

/* Comments */

The comments were the main difficulty with this addition, so I’m going to step through the comment state of all the languages that use /* comments since I changed them so drastically. C11, C99 and C++ all use the same comment path, unsurprisingly, so I’ll just refer to this group as C. The other unique comment blocks are in asm and Fortran.

The polyglot starts out with a preprocesser directive of the form of #1 "", which refers to a line number and file name in quotes. The previous answers followed this with a //* to line comment in C and block comment in asm. Fortran didn’t accept this comment style, so things had to change, and the fix was to change line 1’s comment to a block style comment with a #1 ""/* bla */ pattern.

Line 2’s answer held Japt, which it somewhat syntactically rigid in the polyglot, so I opted to leave Japt’s line 2 answer intact. Japt transpiles to JavaScript BTW, which is another /* style comment language, but these comment indicators can get altered in the transpolation. The /* at the beginning of line 2 is such a case. By converting the // comment to a /* comment on line 1, japt needed the /* comment to close, so a */ was added to the end of line 1.

This BTW broke <><, so we now redirect it’s IP to line 2 since / is conveniently a reflector.

Okay, so line 1 is a single line block comment for C, a # style line comment for asm, and an unknown preprocessor directive for Fortran, which only issues a warning. Line 2 starts a block comment for C and Fortran, and asm again ignores it as a line comment. The Fortran block comment is in the middle of a preprocessor directive and so is required to end the comment just prior to the completion of the directive, or with a line feed. I chose the latter.

From here, asm continues to see line comments until we arrive at #2""/*\* which is the pre-processor pattern from before. The \* exists here because Agony needed a second * to complete its copy paste operation, and Retina needed the \ to escape out the second *.

Ok, we’ve established the 3 languages in a comment and can move down the polyglot to evil’s line where we drop out of the comment and begin the real work.

We start with a #if 0 directive, valid in both C and Fortran as initiating a non-executing preprocessor if block. Perfect! We can answer asm within the block and move to close the block as well as start a Fortran comment with #endif//*.

Following this, we have to close asm so we’ll once again use our preprocessor output file syntax to begin an asm comment, which leaves only C open. So we’ll just answer for the C family and end with //*/ , which sets asm and Fortran comments to a closed state.

Now, all the comments are closed, and we need to have a state when only Fortran is open. I don’t actually see a good way to do this, so I take the verbose track of starting a Fortran only comment with #endif//* and then toggling all 3 languages with /*/.

Finally! We can answer Fortran with print'("72")';end; and then put Fortran back into a comment with the same if block trick from before. Hurray!

Currently we’re closing the comment for all 3 on the final line with */// which somehow works for all 3 and I don’t totally understand why. But I accept that it is valid and that is enough.

What

I massively busted What with my changes, and it turns out that any change has a 2/3 chance of busting what, if the code is placed prior to its code. So I move it into line 2, to mitigate that problem going forward.

This caused some Cubix problems because the starting IP was dead center in INTERCAL. I fixed by changing some INTERCAL DOs to FACs and adding a padding x at the end of line 2.

Golf Report

I cut ! on line 2 after finding experimentally that it was not needed by Underload.

Similarly, I removed ) and a ( near the beginning of line 1 because Underload could get by without it.

Prelude no longer needed the space in the Brain-Flak’s code, so I cut that.

Alphuck got its end of polyglot s’s rearranged because the changes to line 1 caused the 2D langs that wrap around the polyglot to be off by 1 column. I had to shorten the last 2 lines to match so, I moved some leading s’s to near the end.

There is a bit of overhead to put code at the end of the polyglot, so rk was ripe for some byte saving simply by moving it. Now it lives near the beginning of the final C family comment block.

Incident Report

<>{nd became <>{ because nd was no longer needed to be detokenized Removed the space between }} and + in #<]}} +<[<.>>-]>[ to detokenize because }}+ no longer needed to be detokenized.

I removed “6” at the end of commercial with no good reason.

Added a 5 to the Brain-Flak line.

removed the 59 detokenizing string from the Minimal-2D space and replaced it with a q to detokenize q because e the space was now only 1 char wide. Never replaced the 59

\$\endgroup\$
2
  • \$\begingroup\$ Hey, that "6" was added to detokenize a "6, I had a good reason for it, I swear :P \$\endgroup\$ Commented Jun 9, 2017 at 11:29
  • \$\begingroup\$ "clock comments" \$\endgroup\$ Commented Jun 9, 2017 at 17:00
12
\$\begingroup\$

64. Agony, 1613 bytes

#16  "(}+?23!@)-("//*\Dv;'[af2.qc]PkPPX'#)"14";n4
#/*0|7//```"`   [-'][!(>77*,;68*,@;'1,@10␉11)(22)S␉␉␉(1 P''53'S^'q
#>␉
# 36!@␉`
#
#_>++++.>.}+?
#`<`
#<]}}+<[.>-]>[
#{
#z}
#
#=x<R+++++[D>+++++++59L+++<-][pPLEASE,2<-#2DO,2SUB#1<-#52DO,2SUB#2<-#32DOREADOUT,2PLEASEGIVEUPFACiiipsddsd4O6O@oh]>@@+.---@.>][
#x%+>+=ttt Z_*.
#D>xU/-<+++L
#R+.----\).>]|
#[#[(?2?20l0v0x1k1kMoOMoOMoOMoOMOO0l0ix0jor0h0h1d111x0eU0yx0y0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k1x0vx0v0l111111^_00)
[ "]56p26q[puts 59][exit]" ,'\[' ];#/s\\/;print"24";exit}}__DATA__/
#
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.

#
'(((p\';a=a;case $argv[1]+${a:u} in *1*)echo 50;;*A)echo 54;;*)echo 58;;esac;exit;';print((eval("1\x2f2")and 9or 13)-(0and 4)^1<<(65)>>62)or"'x"or'{}{}{}{}({}<(((((()()())){}{})){}{})>){(<{}(({}){})>)}{}({}())wWWWwWWWWwvwWWwWWWwvwWWWwWWWWWWWWwWWWWwWWWWWWWwWWWWWWWW li ha '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("'3)3)3)"'
__DATA__=1#"'x"
#.;R"12"'
###;console.log 39
""""
=begin
<>{
#sseeeemPaeueewuuweeeeeeeeeeCis:ajjap*///;.int 2298589328,898451655,12,178790,1018168591,84934449,12597/*
#define p sizeof'p'-1?"38":"37"
#include<stdio.h>
main ( ){puts(p);}/*
print 61
#}
disp 49;
#{
}<>
$'main'3
#-3o4o#$$$
#<q>"3"O.s
=end
"""#"
#}
#s|o51~nJ;#:p'34'3\=#print (17)#>27.say#]#print(47)#]#echo 21# xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi ax fwwvwWWWwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwvwWWwwwwwwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwvm
# sss8␛dggi2␛`|$// ''25  16*///~-<~-<~-<<<~-}+^_^_X2229996

VIP score (Versatile Integer Printer): .006153 (to improve, next entry should be no more than 1689 bytes)

Try it online!

Rundown

This program prints 64 in Agony, 63 in Brian & Chuck, 62 in Grass, 61 in S.I.L.O.S, 60 in Moorhens 2.0, 59 in Tcl, 58 in Ksh, 57 in Wise, 56 in dc, 55 in Brain-Flak Classic, 54 in Zsh, 53 in Shove, 52 in COW, 51 in Assembly, 50 in Bash, 49 in Octave, 48 in Deadfish~, 47 in Lily, 46 in Cubix, 45 in PicoLisp, 44 in alphuck, 43 in reticular, 42 in evil, 41 in brainfuck, 40 in Minimal-2D, 39 in CoffeeScript, 38 in C, 37 in C++, 36 in Labyrinth, 35 in INTERCAL, 34 in Rail, 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Most languages can be tested with the test driver above, but 6 languages have to be tested locally.

  • Reng can be tested to output 19 here.

  • Modular SNUSP can be tested to output 31 here.

  • Incident was verified to test 33 via manual balancing of tokens.

  • Deadfish~ was can be tested to output 48 locally, using this interpreter. Note that Deadfish~ takes the polyglot to be fed on stdin, but and prints a number of >> prompts to standard output, which are n unavoidable consequence of running any Deadfish~ program.

  • Moorhens 2.0 can be tested to output 60 using this interpreter.

  • Agony can be tested to output 64 using this interpreter

Agony

Agony is another brainfuck derivative, but quite an interesting one. I found it on the list of esolangs and it seemed to be fit for this polyglot. It ignores all characters it doesn't recognise (it only recognises $*+-@~[]()<>{}.,). Most brainfuck programs also work in Agony, but every memory cell only has 4 bits. On top of that, the code and memory share the same space, so this language is self-modifying as well (though we don't use that here). Input and output work on two memory cells, effectively the same as brainfuck. The commands @~{}() are the counterparts of +-<>[] respectively, but they only work on one memory cell. The commands imported from brainfuck work on two memory cells.

The program stops when it reaches the first $ and it knows two loops (() and []) which can also be executed 0 times, effectively adding holes to the code. It's important to skip .s until we've placed the correct value on the tape, as that is the output command.

Let's get to the code Agony sees. As I said before, all characters it doesn't recognise are discarded. The ^ character indicates that this is either a loop that isn't executed or a comment to indicate the line number.

(^)-(*[^])
*[-][^line 8^]}}+<[^]>
[{}^line 12^<+++++[>++++++++++<-][^]>@@+.---@.>[^line 19^$

The first loop is skipped, because the memory starts as 0. Then, the memory value is decremented, so it is non-zero, so it enters the loop. Then, the * character is executed, which copies the current memory value and replaces it by 0. That causes the [] loop to not be executed. Then there's another *, which pastes the (non-zero) copied value. This causes the [-] loop to be executed, which decrements the memory value until it reaches 0. This then causes the next loop to not be executed. Then, we move the memory pointer two positions to the right, increment that memory value and then move the memory pointer back to the 0 memory value. This causes the following loop to not be executed. Then > moves the memory pointer to the 1 value, so the next loop is executed.

Until now, we've followed the exact same path as brainfuck, so we now reach the loop that sets brainfuck's memory cell to the ASCII value for 3. We follow that same loop, until it reaches the output. There, brainfuck prints 41. To print 64, we simply add two @ commands before the first print (they are not recognised by brainfuck, so that is not messed up), and one before the second print.

Other changes

First of all, I added a - on line two, which caused several 2D languages to misalign. To fix this, I removed the tab just before it and placed it later on the same line. This fixed all the 2D languages and Whitespace was happy as well.

Secondly, I added two }s on line 8, which caused an Incident. }+ was tokenised, so to counter that, I added }+ to the very last line, just before ^_^_.

Thirdly, I moved Cubix' code one line up, because the o from the Deadfish~ part caused a null byte to be prepended to Cubix' output.

I think this also is a good place to note that the c in the very first line turned out to be just a filler character, so we might be able to replace that in the future.


This is my very first contribution to this project and I couldn't have done this without the help from the people in the chatroom. I want to thank @Chance and @ais532 in particular because of their help and guidance. I'm looking forward to making another contribution soon!

\$\endgroup\$
2
  • \$\begingroup\$ "The stack"? There's no stack! \$\endgroup\$ Commented Jun 9, 2017 at 16:52
  • \$\begingroup\$ You're right. Fixed it. \$\endgroup\$
    – Luke
    Commented Jun 9, 2017 at 21:57
12
\$\begingroup\$

77. C++14, 2089 bytes

#16  "}(o+?23!@- "/*\Dv;'[af2.q]PkPPX)\('#CO"14";*/
#/*0|7//```"`  )[-'][(>77*;,68*,@,1',;# l1011)(22)\4nS ␉;␉␉␉(1P''53'S^'????!?!??!??!!!!???!?!??!!?!?!!!!!?!!!!?????!????????????????????!) (qx
#>␉
# 36!@␉`
#
#_>++++.>++++++::@---x---.+?
#`<`
#<]}}+<[<<.>>x>-]>[
#{
#x}
#2""/*\*
#=x<R+++++[D>+++++++qL+++<-][pPLEASE,2<-#2FAC,2SUB#1<-#52FAC,2SUB#2<-#32FACREADOUT,2PLEASEGIVEUPFACiiipsddsdoh]>@@+.---@.>][
#x%+>+=ttt Z_*.ar
#D>xU/-<+++L
#R+.----\).>]|
#[#[(?2?20l0v01k1kMoOMoOMoOMoOMOO0l0ix0jor0h0h1d111\4O6O@x0eU0y0yx0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k1x0vx0v0l111111^_0)0
[ "]56p26q[puts 59][exit]" ,'\['];#/s\\/;print"24";exit}}__DATA__/
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.<
'((( p\';a=a;case $argv[1]+${a:u} in  *1*)echo 50;;*A)echo 54;;*)echo 58;;esac;exit;'␉;print((eval("1\x2f 2")and 9or 13<<(65)>>65or 68)-(0and 4)^1<<(65)>>62)or"'x"or' {}{}{}{}({}<(((((()()())){}{})){}{})>){(<{}(({}5){})>)}{}({}() )wWWWwWWWWwvwWWwWWWwvwWWWwWWWWWWWWwWWWWwWWWWWWWwWWWWWWWWwwwwvwWWWwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwvwWW li ha '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("3'3)))"'#
__DATA__=1#"'x"
#.;R"12"'
###;console.log 39
""""
=begin
<>{
utpb now 70 dollar off!
ai
utpb has been selling out worldwide!
ai fir at fir
#sseeeemPaeueewuuweeeeeeeeeeCis:ajjapp*/
#if 0
.int 2298589328,898451655,12,178790,1018168591,84934449,12597
#endif//*
#1"" //*
#include<stdio.h> 
#define ␉p(d) #d
#define u8 "38\0_"
main (  ){puts( sizeof( 0,u8)-5?u8"67":*u8""?"37":p(0'0  "'\"")[9]?"75":"77" );"7";}//*/
#if 0
#endif//* --... ...--
/*/
print'("72")';end;
#if 0␌
#endif//* rk:start | print: "69" rk:end<>5b*:,1-,@<>
print 61
#}
disp 49;
#{
}<>
$'main'3
#-3o4o#$$$
#<T>"3"O.</+++++++>/+++<-\>+++.---.
=end
"""#"# xi xi xi xi \++++>/ xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi os
#}
#s|o51~nJ;#:p'34'3\=#print(17)#>27.say#]#print (47) #]#echo 21#fwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwvm>++++
#s8␛dggi2␛M`|$//''   16~-<~-<~-<<<~-COprint("65")#ssss^_^_#
#5 "25"  +/ *///X222999686#

VIP score (Versatile Integer Printer): .004575 (to improve, next entry should be no more than 2171 bytes)

This program prints 1 in Python 3, 2 in V/Vim, 3 in Minkolang, 4 in ><>, 5 in Python 2, 6 in SMBF, 7 in Japt, 8 in Retina, 9 in Perl 5, 10 in Befunge-93, 11 in Befunge-98, 12 in Fission, 13 in Ruby, 14 in Turtlèd, 15 in Haystack, 16 in Pyth, 17 in Julia, 18 in Cardinal, 19 in Reng, 20 in Prelude, 21 in Nim, 22 in Underload, 23 in Hexagony, 24 in Thutu, 25 in Pip, 26 in 05AB1E, 27 in Perl 6, 28 in Brain-Flak, 29 in Trigger, 30 in Whitespace, 31 in Modular SNUSP, 32 in Whirl, 33 in Incident, 34 in Rail, 35 in INTERCAL, 36 in Labyrinth, 37 in C++03, 38 in C99, 39 in CoffeeScript, 40 in Minimal-2D, 41 in brainfuck, 42 in evil, 43 in reticular, 44 in alphuck, 45 in PicoLisp, 46 in Cubix, 47 in Lily, 48 in Deadfish~, 49 in Octave, 50 in Bash, 51 in Assembly, 52 in COW, 53 in Shove, 54 in Zsh, 55 in Brain-Flak Classic, 56 in dc, 57 in Wise, 58 in Ksh, 59 in Tcl, 60 in Moorhens, 61 in S.I.L.O.S, 62 in Grass, 63 in Brian & Chuck, 64 in Agony, 65 in ALGOL 68, 66 in Surface, 67 in C11, 68 in Python 1, 69 in rk-lang, 70 in Commercial, 71 in what, 72 in Fortran, 73 in Morse, 74 in Archway, 75 in C++11, 76 in Trefunge-98, 77 in C++14

Verification

Try it online!

Languages that are not on TIO:

  • Reng (#19) online.

  • Deadfish~ (#48) local. Run like this: deadfish.py < polyglot. Prints a bunch of >> lines, but that's an unavoidable consequence of running any Deadfish~ program, so it's okay.

  • Moorhens (#60) local. Use python 2. Note that moorhens.py from master branch doesn't work.

  • Morse (#73) local.

  • Archway (#74) local

  • Trefunge-98 (#76) local. Note that flags must be -v 98 -d 3 for Trefunge-98. Could also be installed via pip.

Languages that use abstracted interpreters in the test driver:

Other languages:

  • Japt (#7) was updated in Tio to fix the parsing error we've been exploiting, so it must be tested individually online.

  • Surface (#66) local. Tio Surface interpreter is no contest because it was created after challenge was started.

Explanation

Adding C++14

I am using digit separators to separate C++14 from C++11. See also: stringizing.

#define s(x) #x // stringize
puts( s(0'0  "'\"")[9] ? "C++11" : "C++14" );

C++11 sees 4 tokens: 0, '0 "', \, "" and puts them in a string as is. C++14 sees 2 tokens: 0'0 and "'\"". Two spaces between these tokens are collapsed into one, so resulting string is one char shorter than in C++11.

I also tried using comments: s(0'0/*'*/). C++14 sees it as token 0'0 followed by comment; comment is replaced with space, which is then discarded (because it is trailing). C++11 sees it as sequence of 4 tokens (0, '0/*', *, /), nothing is replaced/discarded. But I cannot use it because multiline comment breaks assembler. If use single-line comments instead:

s(0'0//'
)

then closing paren needs to be padded with 13 bytes to satisfy Prelude, which is more bytes than just using a string.

Fixing other languages

Prelude, incident and alphuck broke as a result. Prelude and incident are fixed as usual. Spaces around main() are for prelude. Space after <stdio.h>, tab before p(d), space after "77" are there to break unwanted incident tokens. Macro parameter called d also for that reason, to untokenize #d. "7"; is there to untokenize "7.

Alphuck is fixed by naming macro p and adding another p to ajjap (seems like number of s and p should match for alphuck to work).

C vs C++

As someone who worked with a processor with sizeof(void*) == sizeof(int) == sizeof(char) == 1 (TMS320C33, search for "A TMS320C3x/C4x Byte Is 32 Bits"), I didn't feel very comfortable with separating C from C++ using sizeof('p'). So I decided to search for another method, hopefully not too much more verbose than existing one. I found this: in the C++ standard, par C.1.4 page 1232 "Change: The result of a conditional expression, an assignment expression, or a comma expression may be an lvalue"

char arr[100];
sizeof(0, arr)

yields 100 in C++ and sizeof(char*) in C

Luckily, we already have an array - u8. Also we already have redundant use of it to satisfy incident (see u8; after puts(p); in the previous answer). So we can just put that into use. I only changed its size from 4 to 5 bytes because 4 is a common pointer size. So to separate C++ from C I use sizeof(0,u8)-5. It should work on all architectures except those were sizeof(void*) == 5.

\$\endgroup\$
9
  • \$\begingroup\$ RIP online Japt testing please unfix (or provide a flag for enabling broken behavior or something) \$\endgroup\$ Commented Jun 19, 2017 at 17:51
  • \$\begingroup\$ @CalculatorFeline I don't quite understand what you want me to do. I personally also don't like that we use interpreter bug (seems unfair to me) and ended up in this situation. But I can't see how it could be fixed. \$\endgroup\$
    – stasoid
    Commented Jun 19, 2017 at 18:17
  • \$\begingroup\$ Ask (whoever makes Japt) to add a flag reintroducing the parser bug so we can pretend we're using an earlier version. \$\endgroup\$ Commented Jun 19, 2017 at 18:19
  • \$\begingroup\$ @CalculatorFeline I don't want to solve this problem, at least at the moment. If you want this done you could ask him yourself. \$\endgroup\$
    – stasoid
    Commented Jun 19, 2017 at 18:25
  • \$\begingroup\$ Not interested enough :/ \$\endgroup\$ Commented Jun 19, 2017 at 18:28
12
\$\begingroup\$

62. Grass, 1617 bytes

#16  "(}23!@)(" 3//*v\D;'[af2.qc]PkPPX'#)"14";n4
#/*0|7//`"`   ['][!(>77*,;68*,@;'1,@1␉0␉␉11)(22)S␉(1 P''53'S^'q
#>␉
# 36!@␉`
#
#
#`<`
#<]+<[.>-]>[
#{
#z}
#
#=x<R+++++[D>+++++++  L+++<-][pPLEASE,2<-#2DO,2SUB#1<-#52DO,2SUB#2<-#32DOREADOUT,2PLEASEGIVEUPFACiiipsddsdoh]>+.-- -. >][
#x%+>+=ttt Z_*.x4O6O@
#D>xU/-<+++L
#R+.----\).>]|
#[#[(}2}20l0v0x1k1kMoOMoOMoOMoOMOO0l0ix0jor0h0h1d111x0eU0yx0y0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k10vx0v0l111111^_00)
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.|
#
[ "]56p26q[puts 59][exit]" ,'\[' ];#//
'(((p\';a=a;case $argv[1]+${a:u} in *1*)echo 50;;*A)echo 54;;*)echo 58;;esac;exit;';print((eval("1\x2f2")and 9or 13)-(0and 4)^1<<(65)>>62)or"'x"or'{}{}{}{}({}<(((((()()())){}{})){}{})>)\{(<{}(( {}){})>)}{}({}())wWWWwWWWWwvwWWwWWWwvwWWWwWWWWWWWWwWWWWwWWWWWWWwWWWWWWWW li ha '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("'3)3)3)"|/=1/24=x'/
__DATA__=1#"'x"//
#.;R"12"'
###;console.log +39
""""#//
=begin //
#sseeeemPaeueewuuweeeeeeeeeeCisajjap*///;.int 2298589328,898451655,12,178790,1018168591,84934449,12597/*
#define p sizeof'p'-1?"38":"37"
#include<stdio.h>
main ( )/*/
#*/{puts(p);}/* 
#
/*
1=61 //
printInt 1//
<>{//
#}
disp 49#//
#{
}<>//
$'main'//
#-3o4o#$$$
#<R>"3"O.s
=end #//
"""#"#//
#}
#s|o51~nJ;#:p'34'\=#print (17)#>27.say#]#print(47)#]#echo 21# xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi ax fwwvwWWWwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwvwWWwwwwwwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwvm
#sss8␛dggi2␛`|$//''25  16*///~-<~-<~-<<<~-^_^_X2229996

Try it online

VIP score (Versatile Integer Printer): .006780 (to improve, next entry should be no more than 1695 bytes)

Rundown

This program prints 62 in Grass 61 in S.I.L.O.S, 60 in Moorhens 2.0, 59 in Tcl, 58 in Ksh, 57 in Wise, 56 in dc, 55 in Brain-Flak Classic, 54 in Zsh, 53 in Shove, 52 in COW, 51 in Assembly, 50 in Bash, 49 in Octave, 48 in Deadfish~, 47 in Lily, 46 in Cubix, 45 in PicoLisp, 44 in alphuck, 43 in reticular, 42 in evil, 41 in brainfuck, 40 in Minimal-2D, 39 in CoffeeScript, 38 in C, 37 in C++, 36 in Labyrinth, 35 in INTERCAL, 34 in Rail, 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Most of the languages are tested by the test driver shown above.

  • Reng can be tested to output 19 here.

  • Modular SNUSP can be tested to output 31 here.

  • Amazingly the incident tokenizer in the test driver indicated that the tokens had not changed from the last entry, so I did not bother to run this.

  • Deadfish~ was can be tested to output 48 locally, using this interpreter. Note that Deadfish~ takes the polyglot to be fed on stdin, but and prints a number of >> prompts to standard output, which are n unavoidable consequence of running any Deadfish~ program.

  • Moorhens 2.0 can be tested to output 60 using this interpreter.

Explanation

Here is the Grass code:

wWWWwWWWWwv
wWWwWWWwv
w WWWw WWWWWWWWw WWWWw WWWWWWWw WWWWWWWWwwww v
wWWWwWWWWwv
wWWwWWWwv
wWWwWWWwv
wWWwWWWwv
wWWwwwwwwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwv

Try it online!

It was taken from an earlier answer made by myself and 1000000000.

Evil

The first problem with inserting the grass was that evil already had some ws in its code which would mess with the grass. In order to fix this I split the grass code into two sections straddling the evil code. Now evil had a little bit of a problem with the grass code. Each w in the grass code printed a null character \x00 so I needed to skip over all the ws, this was done easily with a f and an m.

Cubix

Cubix once again broke because of the increase in program size so I had to move the capsule. Moving the Capsule broke cardinal, but I was able to fix it by adding an x before the Cubix.

\$\endgroup\$
1
  • \$\begingroup\$ SILOS has recently had changes, therefore, this was valid with a recent commit, but with the new version, l=61 // doesn't quite work, instead please change it to l+61 \$\endgroup\$ Commented May 18, 2017 at 21:57
11
\$\begingroup\$

18. Cardinal, 137 bytes

#v`16 "<" 6/b0\ .q@#;n4"14""
#>3N9@15o|R"12"*^*ttt*~++%
#=|
print((1/2and 9 or 13)-(0and+4)^1<<65>>62);# =#;print(17)
#gg99ddi2` |1|1+6

Literal escape chars between # and g, and 2 and `.

Prints:


Edit: Fixed esc character between o and | - don't know why it was there in the first place.

\$\endgroup\$
12
  • \$\begingroup\$ Bytes cannot be fractions, so the limit was really floor(128 * 1.2), so good thing you didn't need another byte. \$\endgroup\$
    – mbomb007
    Commented Dec 7, 2016 at 19:52
  • \$\begingroup\$ Also, this is incorrect, as it prints 6\x00 in SMBF. (There are two . characters.) \$\endgroup\$
    – mbomb007
    Commented Dec 7, 2016 at 19:54
  • \$\begingroup\$ Can we get the SMBF to modify out the second period? \$\endgroup\$
    – Pavel
    Commented Dec 7, 2016 at 19:56
  • \$\begingroup\$ Oh right, forgot about the second period. Shoot. \$\endgroup\$ Commented Dec 7, 2016 at 19:57
  • 2
    \$\begingroup\$ @ais523 It was deleted for a little while, but it should be fixed now. As far as I know, it works with all 18 languages... \$\endgroup\$ Commented Dec 7, 2016 at 22:22
11
\$\begingroup\$

39. CoffeeScript, 828 bytes

#  1"16" 3//v\(@#/;n4"14"
#/*`3 auaaZ<>16/"<"6/b.q@")(22)S#  ␉␉␉␉ 
#yy␉;36!@
### ␉
#=␉>
#[#yy#yy0l0mx01k1k0l0ix0jx0h0h1d111P0eU0bx0b0o1d0b0e0e00x1d0i0fx0g0n0n11x0o0n0cx0c0o0f0c0gx0g0f0h0j0j0i0001k10mx0m0l11111100(^_)
#`<`␉|
print((eval("1\x2f2")and( 9 )or(13 ))-(0and 4)^1<<(65)>>(62))or'(\{(\{})(\{}[()])}\{}\{}\{})'#46(8+9+9+9+9+=!)#1111|=/=1/24=x=9[<$+@+-@@@@=>+<@@@=>+<?#>+.--.]/
__DATA__=1#//
#.\."12"*␉
###; console.log  39
""""#//
=begin␉//
#*/
#define␉z  sizeof 'c'-1?"38":"37"
#include<stdio.h>
int main()  /*/
#()`#`\'*/{puts(z);;}/*'``
$'main'␉//
#-3o4o#$$$
<>3N.<>␉//
#xx
#x%~~~+␉+~*ttt*.x
#xx
=end   #//
"""#"#//
#0]#echo 21#/(\[FAC,1<-#2FAC,1SUB#1<-#52FAC,1SUB#2<-#32FACLEGEREEX,1PLEASEGIVEUPPLEASE)  ap
#_~nJ|#o51\   
#0␛dggi2␛`␉|1|6$//''25  >>>#>27.say# =#print(17)###^_^_7LEintndus({})!<>+]/*///Z/}23!@222999"26

is a literal tab, a literal ESC character; Stack Exchange would mangle the program otherwise. I recommend copying the program from the "input" box of the TIO link below, if you want to work on it.

Try them online!

Rundown

This program prints 39 in CoffeeScript, 38 in C, 37 in C++, 36 in Labyrinth, 35 in INTERCAL, 34 in Rail, 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Most of the languages are tested by the test driver shown above. You can test Reng here and Modular SNUSP here; they output 19 and 31 respectively, as required.

Here is yet another evolution of the Incident tokenizer, I reworked it so the polyglot can be put directly to input and removed the linefeed replacing format from the test driver since it was no longer needed.

Edit: Thanks to @SnoringFrog to pointing out how to fit CoffeeScript into the test driver. Link is updated.

Explanation

This answer came directly from this general polyglot tip by @Sp3000 where I learned that Coffeescript used # based comments, and a different block comment indicator than all the other languages we’ve used so far. @Sp3000’s example didn’t have the output going to STDOUT though. So I took a quick trip over to the PPCG Hello, World! Collection and found that @Lynn provided an example here that was closer to my STDOUT tastes. Sweet.

Here are the CoffeeScript syntactic highlights:

  • # This is a line comment
  • ### This is a block ###
  • """ This is a literal string"""
  • console.log 39 # This is the STDOUT print statement

There were only a couple quirks with CoffeeScript that I had to work out. First, the print statement really needed to live behind a # to hide from the other languages, but the statement seemed to want to be on its own line. This was eventually resolved by throwing a ; between the end of the comment block and the print statement.

Second, the block comments seem fail on the C/C++lines. I’m not sure why exactly, but my guess is something to do with the /* comments. (CoffeeScript is used to programmatically generate JavaScript which uses /* comments. /Shrug. ) In any event, I found that I could use Python’s syntactically matching literal string to hide this code more effectively. So I simply dropped out of the block comment earlier than I had planned to print 39 and everything else was just magically hidden from CoffeeScript. Great Success!

The Few Things I Did Break

Retina didn’t like the line I inserted for console.log 39, so I needed to remove a line for Retina’s rule of even numbers. Maybe I just made that rule up, or maybe it’s legit. It feels legit. Anyways, there was already a do nothing line in the Python string. So I just removed that. This changed the value of Retina’s output, but that was easy to fix by throwing a few more 1’s in the long Python print statement. So far so good.

Hexagony’s hex got bumped up to the next size, so I had to resolve that. But first, the new Hexagony module /(3!@) , while super effective, made my Prelude sense tingle. I didn’t like the idea of having to move this all the time for Hexagony’s alignment and then having to redo Prelude’s vertical parenthetic alignment. So I dug in and found a new Hexagony module that didn’t have this poly-linguistic baggage: /}23!@.

Incident, in all these tweaks lost its singular left side incidental token. (Get it? Cuz it’s not used by Incident… Never mind). The easiest solution to re-balance Incident’s center token turned out to be CoffeeScript’s block comment. So, I added the 3rd ### just prior to final pair of jump tokens (^_). This put one unused token on the left side and eight unused tokes on the right side. (Eight minus one is lucky number seven.) This also happened to align the hexagon so the Hexagony module could be nested in Trigger’s code like so: Z/}23!@222999.

Whitespace was the last piece of broken code, but it was not too difficult rebuild. It was just a matter of removing lines from the end until it worked, and then putting them back one by one and figuring out if I should make it a triple space line, a tab line, or a no whitespace line.

Good Luck.

\$\endgroup\$
5
  • \$\begingroup\$ Nice one! There are definitely more things that can be done with #-initiated multi-line comments, I think. \$\endgroup\$
    – Muzer
    Commented Feb 4, 2017 at 1:23
  • \$\begingroup\$ @Muzer Thanks. Yeah, I decided go into some # space since you've been having so much success with the C variants. Looking forward to your next. \$\endgroup\$
    – Chance
    Commented Feb 4, 2017 at 2:12
  • \$\begingroup\$ coffee polyglot.poly is all you need to add it to the driver, at least that worked for me \$\endgroup\$ Commented Feb 6, 2017 at 15:38
  • \$\begingroup\$ @SnoringFrog And of course it's the easy solution I didn't bother to try. Thanks! \$\endgroup\$
    – Chance
    Commented Feb 6, 2017 at 19:42
  • 1
    \$\begingroup\$ "Retina’s rule of even numbers" → Retina has two parsers, and (in the common case where lines don't contain the backquote character) alternates which one it uses from one line to the next. One is a lot more tolerant than the other one, so making sure that complex lines end up on the tolerant parser is likely going to be helpful. \$\endgroup\$
    – user62131
    Commented Apr 27, 2017 at 23:53
11
\$\begingroup\$

40. Minimal-2D, 902 bytes

    #  1"16" 3//v\(@#/;"14"\Dv
#/*`3 auaaZ<>16/"<"6/b.q@")(22)S#  ␉␉␉␉ 
#yy␉;36!@
### ␉
#=␉>
#[#yy#yy0l0mx01k1k0l0ix0jx0h0h1d111P0eU0bx0b0o1d0b0e0e00x1d0i0fx0g0n0n11x0o0n0cx0c0o0f0c0gx0g0f0h0j0j0i0001k10mx0m0l11111100(^_)
#`<`␉|
print((eval("1\x2f2")and( 9 )or(13 ))-(0and 4)^1<<(65)>>(62))or'(\{(\{})(\{}[()])}\{}\{}\{})'#46(8+9+9+9+9+=!)#1111|=/=1/24=x=9[<$+@+-@@@@=>+<@@@=>+<?#>+.--.]/
__DATA__=1#//
#.\."12"*␉
###; console.log  39
""""#//
=begin␉//
#*/
#define␉z  sizeof 'c'-1?"38":"37"
#include<stdio.h>
int main()  /*/
#()`#`\'*/{puts(z);;}/*'``
$'main'␉//
#-3o4o#$$$
<>3N.<>␉//
#xx\"R++++++++++++++++++\"++++++++++++++++++.----.
#x%~~~+␉+~*ttt*.x
#xx++U++++++++++++++++v<L>4n;
=end   #//
"""#"#//
#0]#echo 21#/(\[FAC,1<-#2FAC,1SUB#1<-#52FAC,1SUB#2<-#32FACLEGEREEX,1PLEASEGIVEUPPLEASE)  ap
#_|#o51~nJ\   
#0␛dggi2␛`␉|1|6$//''25  >>>#>27.say# =#print(17)###^_^_7LEintndus({})!<>+]/*///Z/}23!@222999"26

is a literal tab, a literal ESC character; Stack Exchange would mangle the program otherwise. I recommend copying the program from the "input" box of the TIO link below, if you want to work on it.

Try it online!

Rundown

This program prints 40 in Minimal-2D, 39 in CoffeeScript, 38 in C, 37 in C++, 36 in Labyrinth, 35 in INTERCAL, 34 in Rail, 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Most of the languages are tested by the test driver shown above. You can test Reng here and Modular SNUSP here; they output 19 and 31 respectively, as required. Minimal-2D is not available on TIO, but a python interpreter is available here.

Current version of the Incident tokenizer for working with Incident.

Explanation

I couldn't find something I knew that would work, so I googled "2D language" and used the first thing that popped up.

Minimal-2D is essentially Brainfuck, except it lacks loops and used UDLR to redirect a pointer around. If the pointer hits an edge of the file, execution terminates. It can probably be golfed down somewhat; if I get a chance before the next answer comes in I'll try to do that.

The D on the first line sends the pointer downwards to the L in <L>, then the rest is dumb, brute force brainfuck to the U and R. The ++ preceding the U is filler to not break Fission, and the final + on line 22 is Hexagony filler.

Things that broke

><> breaks on D, so it's code is now redirected downwards. Since I was already extending line 20, I used that to terminate the string that got started, and moved the >4n; into line 22. I tried to just use ! to skip the D, but Turtled didn't like that.

Fission broke in various places, which led to filler characters throughout this process. The ++ before the U is all that's left of that now, I think. Those could be changed to whatever is necessary for other languages.

Perl 6 didn't like my unmatched >, so I added in a <.

05ab1e went a little crazy over my extra quotation mark, so I quoted most of line 20 to appease it.

Pyth didn't like the D or the quotations, so all of those got escaped (at least I guess that's what happened? I just tossed a \ before all of them and it worked, so I moved on).

Hexagony was broken most of the time. Then at the end it miraculously worked.

Reng was apparently broken a few answers back and was outputting a nonprintable character before the 19. That's been fixed now by putting the Haystack code before the Reng.

Incident, by this point, had picked up two new tokens that shifted the center, v and +<. So I changed my +< to +v<. Problem solved.

Scores from The versatile integer printer

Just for kicks and going off of @Stewie Griffin's comment on the question, here's a snippet that shows how each answer would have scored if it was entered into "The Verstatile Integer Printer". So far, looks like answer 31 was our best score with a .01094, but still not quite good enough to beat the best VIP score of .009185.

// This was stolen/sloppily hacked together from the snippet here: https://codegolf.stackexchange.com/questions/55422/hello-world. Feel free to clean it up if you'd like.
/* Configuration */

var QUESTION_ID = 102370; // Obtain this from the url
// It will be like http://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "http://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=asc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "http://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*)[,\(].*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function getScore(langs, bytes) {
  var l = Math.pow(langs,3);
  return bytes/l;
}

function process() {
  var valid = [];
 
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
        score: getScore(match[1].split(".")[0],+match[2]).toFixed(6),
      });
    else console.log(body);
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery('<a>'+lang+'</a>').text();
    
    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link, score: a.score};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    return a.lang_raw.split(".")[0] - b.lang_raw.split(".")[0];
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.score)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#language-list {
  padding: 10px;
  width: 400px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="language-list">
  <h2>Scores from <a href="https://codegolf.stackexchange.com/questions/65641/the-versatile-integer-printer">The Versatile Integer Printer</a></h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>

\$\endgroup\$
6
  • 3
    \$\begingroup\$ Fun note: changing the text after \" to ++]++++[>+++++++++++++<-]>.---<[-]>. will get brainfuck to output 41. Didn't have time to fix the problems that causes, but maybe it's a decent starting point for someone; esp with SMBF. \$\endgroup\$ Commented Feb 6, 2017 at 22:57
  • \$\begingroup\$ I think your Tio link's code is different from your submission. Can you update? \$\endgroup\$
    – Chance
    Commented Feb 7, 2017 at 4:10
  • \$\begingroup\$ @SnoringFrog I was under the impression that the only way to produce SMBF code that will have a different result in BF, is to rely on undefined behaviour in BF? Even if you have a BF compiler that allows you to go left without UB, I suspect it'll be rather tricky to get them both to behave... perhaps not impossible though! \$\endgroup\$
    – Muzer
    Commented Feb 7, 2017 at 16:47
  • \$\begingroup\$ @Muzer It'd hinge on the interpreter. Assuming we use TIO, moving left from the start in BF doesn't error out, it's just a no-op. From there it's just getting BF/SMBF to enter/skip different loops than one another. This does it (kept the line structure of the current program but stripped unnecessary characters). Mixing that w/ the other langs is the issue then. \$\endgroup\$ Commented Feb 7, 2017 at 21:37
  • \$\begingroup\$ @Muzer But I'm not seeing any good/easy way to do that. I'd wager the SMBF needs to be significantly altered to have a chance at making this work with everything else. That line 1 period is annoying. \$\endgroup\$ Commented Feb 7, 2017 at 21:58
11
\$\begingroup\$

29. Trigger, 292 bytes

#v`16/"<"6/b.q@"(: ::T): :(22)S#;n4"14"
#>3N6@15o|> ^*ttt*~++~~~%
#=~nJ<R"12";
#[
#`<`|
print((eval("1\x2f2")and (9) or (13))-(0and 4)^(1)<<(65)>>62)or'(\{(\{})(\{\/+23!@=}[()])}\{})(\{}\{})'#@46(8+9+9+9+9+=!)=#print(17)#]#echo 5+5+11#|/=1/24=x=90/
#8␛dggi2␛` |1|6$//''25  #>say 27#T222999"26

This program prints 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng (tested here), 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Something must have been working in my subconcious in the time since the last submission to this challenge, because by the point I decided it was running low on time and I wanted to ensure it wouldn't die, I suddenly remembered a language from years back that could be added fairly easily as seen by the low increase in the byte count, and quite a bit of that was due to Hexagony rather than Trigger itself. Except for commands that assign to variables (which mostly don't matter), all Trigger's commands contain two consecutive equal characters. The first time this happens is in the Underload code in the first line, so I simply modified that a bit to jump to almost the end of the program, and placed the Trigger code to print 29 (which is 222999) there. The jump label I used is T (originally I tried U but Fission disliked it), but if you need to use a capital T in your own program for some reason, you can easily change both occurrences to something else that isn't used in your program.

Very little else needed changing, apart from (as always) the Hexagony. I decided it was time to stop messing around with formatting the code into a hexagon by hand, but luckily we've already had a challenge about Hexagony parsing, so I went and modified this answer to the challenge into an online-usable Hexagony formatter that handles backticks correctly (here). Here's how this version of the program looks as a hexagon:

         # v 1 6 / " < " 6 /
        b . q @ " ( : : : U )
       : : ( 2 2 ) S # ; n 4 "
      1 4 " # > 3 N 6 @ 1 5 o |
     > ^ * t t t * ~ + + ~ ~ ~ %
    # = ~ n J < R " 1 2 " ; # [ #
   < | p r i n t ( ( e v a l ( " 1
  \ x 2 f 2 " ) a n d ( 9 ) o r ( 1
 3 ) ) - ( 0 a n d 4 ) ^ ( 1 ) < < (
6 5 ) > > 6 2 ) o r ' ( \ { ( \ { } )
 ( \ { \ / + 2 3 ! @ # } [ ( ) ] ) }
  \ { } ) ( \ { } \ { } ) ' # @ 4 6
   ( 8 + 9 + 9 + 9 + 9 + = ! ) = #
    p r i n t ( 1 7 ) # ] # e c h
     o 5 + 5 + 1 1 # | / = 1 / 2
      4 = x = 9 0 / # 8 ␛ d g g
       i 2 ␛ | 1 | 6 $ / / ' '
        2 5 # > s a y 2 7 # U
         2 2 2 9 9 9 " 2 6 .

You might well have noticed that the Nim code is more verbose than it used to be. This is purely because padding it out as 5+5+11 rather than 21 happened to make the Hexagony line up perfectly; if you start at the / of /+23!@#, you can see an uninterrupted run of Hexagony-safe characters, and that's how I made that part of the program work.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ +1 for the updated hexagony formatter. Are there any online resources for testing in Trigger? I think it may have blown out my next solution. :P \$\endgroup\$
    – Chance
    Commented Jan 5, 2017 at 17:00
  • \$\begingroup\$ @Chance: Not yet, although I put in a request for it on TIO. Also, I'd be both surprised and upset if Trigger ended up blocking a language, because it's fairly easy to work into a polyglot; it doesn't parse code you jump over, and its jumping ability is fairly flexible. \$\endgroup\$
    – user62131
    Commented Jan 5, 2017 at 17:16
  • \$\begingroup\$ Yeah, I've been digging into some turing tarpits with limited character sets, which had a lot of repeated characters as you'd expect. I'll read up about Trigger's jumping ability though. Maybe it is workable. \$\endgroup\$
    – Chance
    Commented Jan 5, 2017 at 17:40
  • \$\begingroup\$ @Chance: The : ::U in the current program jumps to the U at the end. Everything in between won't even be parsed, so you can repeat as much as you like there. \$\endgroup\$
    – user62131
    Commented Jan 5, 2017 at 18:31
  • \$\begingroup\$ /+23!@= != /+23!@# \$\endgroup\$ Commented Mar 10, 2017 at 17:16
11
\$\begingroup\$

58. Ksh, 1288 bytes

#16  "(}23!@)(" 3//*v\D;'[af2.qc]PkPPX'#)"14";n4
#/*0|7//`"`   ['][!(>77*,;68*,@;'1,@1␉0␉␉11)(22)S␉( 1P''53'S^'q
#>␉
# 36!@␉`
#
#
#`<`
#<]+<[.>-]>[
#{
#z}
#
#=x<R+++++[D>+++++++  L+++<-][pPLEASE,2<-#2DO,2SUB#1<-#52DO,2SUB#2<-#32DOREADOUT,2PLEASEGIVEUPFACiiipsddsdoh]>+.-- -. >][4O6O@
#x%+>+=ttt Z_*.
#D>xU/-<+++L
#R+.----\).>]|
#[#[(}2}20l0v0x1k1kMoOMoOMoOMoOMOO0l0ix0jor0h0h1d111x0eU0yx0y0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k10vx0v0l111111^_00)
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.|
#
[ ']56pq[' ];#//
'(((p\';a=a;case $argv[1]+${a:u} in *1*)echo 50;;*A)echo 54;;*)echo 58;;esac;exit;';print((eval("1\x2f2")and 9 or 13)-(0and 4)^1<<(65)>>62)or"'x"or'{}{}{}{}({}<(((((()()())){}{})){}{})>)\{(<{}(({}){})>)}{}({}())'#}#(prin 45)(bye)46(8+9+9+9+9+=!)|/=1/24=x/
__DATA__=1#"'x"//
#.;R"12"'
###;console.log 39
""""#//
=begin //
#sseeeemPaeueewuuweeeeeeeeeeCisajjap*///;.int 2298589328,898451655,12,178790,1018168591,84934449,12597/*
#define p sizeof'p'-1?"38":"37"
#include<stdio.h>
main ( )/*/
#*/{puts(p);}/*
#
/*
<>{//
#}
disp 49#//
#{
}<>//
$'main'//
#-3o4o#$$$
#<R>"3"O.
=end #//
"""#"#//
#}
#s|o51~nJ;#:p'34'\=#print (17)#>27.say#]#print(47)#]#echo 21#
#sss8␛dggi2␛`|$//''25  16*///~-<~-<~-<<<~-^_^_X222999"26

Try it online!

is a literal tab, a literal ESC character; Stack Exchange would mangle the program otherwise. I recommend copying the program from the "input" box of the TIO link below, if you want to work on it.

VIP score (Versatile Integer Printer): .006601 (to improve, next entry should be no more than 1355 bytes)

Rundown

This program prints 58 in Ksh, 57 in Wise, 56 in dc, 55 in Brain-Flak Classic, 54 in Zsh, 53 in Shove, 52 in COW, 51 in Assembly, 50 in Bash, 49 in Octave, 48 in Deadfish~, 47 in Lily, 46 in Cubix, 45 in PicoLisp, 44 in alphuck, 43 in reticular, 42 in evil, 41 in brainfuck, 40 in Minimal-2D, 39 in CoffeeScript, 38 in C, 37 in C++, 36 in Labyrinth, 35 in INTERCAL, 34 in Rail, 33 in Incident, 32 in Whirl, 31 in Modular SNUSP, 30 in Whitespace, 29 in Trigger, 28 in Brain-Flak, 27 in Perl 6, 26 in 05AB1E, 25 in Pip, 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng, 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl 5, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in V/Vim, and 1 in Python 3.

Verification

Most of the languages are tested by the test driver shown above.

  • Reng can be tested to output 19 here.

  • Modular SNUSP can be tested to output 31 here.

  • Incident was verified to test 33 by @ais523.

  • Deadfish~ can be tested to output 48 using this interpreter. Note that Deadfish~ takes the polyglot to be fed on stdin, but and prints a number of >> prompts to standard output, which are an unavoidable consequence of running any Deadfish~ program.

Explanation

@ais523 mentioned in his dc post that his answer used the same technique that Lua typically uses in polyglots, and that Lua doesn’t have # comments. I had looked into Lua a while ago and gave up on it because I didn’t know this trick of declaring a literal list from the scripting languages perspective. Last I looked at Lua, I learned that its interpreter would skip the first line if it started with a #. So I looked into creating hole in line two to put Lua.

I succeeded in this endeavor, and pasted the dc line into line 2; thinking Lua and dc would ultimately both live there. Then I noticed something with Japt.

I had recently started paying attention to the JavaScript that was transpiled by Japt, as seen in this utility. Until @WheatWizard’s Japt explanation, I hadn’t been thinking of Japt as a transpiler, mostly because I don’t really know JavaScript any better than I do any other language in this polyglot; which is to say that only really know its basic syntax. So when I glanced at the JavaScript Transpolation it only registered in my front brain as an even bigger symbol-salad than the polyglot itself.

This transpolation revelation lead me to 2 epiphanies. First, Japt transpiles comments – which clarified a LOT of the behavior I had seen. I’ll come back to this in the Japt section. Second, and more importantly, when I pasted dc into line 2 (or more specifically, when I pasted ['] into line 2), the majority of the polyglot got cut from the end of the JavaScript transpolation.

This told me that it might be possible to get Japt to stop giving us so many headaches when we use curly braces. (I have danced around Japt and curly braces in at least 3 previous answers.) And that in turn meant that Ksh could be differentiated from Zsh using the upper case variable expansion I played with in my Zsh answer.

Ksh

The variable expansion ${a:u} returns A in Zsh and a in both Ksh and Bash. Our existing shell script, when run in Ksh, returned the same answer as Zsh, so thanks to @whearwizard’s golf suggestion, we concatenated our existing case select argument $argv[1] with ${a:u}, and created a third case which looks for A to differentiate Zsh and Ksh. (On my own I would have nested cases which is more verbose.)

We also have to assign the a variable with the a value, which is what’s happening at the beginning of this Bash/Ksh/Zsh polyglot.

;a=a;case $argv[1]+${a:u} in *1*)echo 50;;*A)echo 54;;*)echo 58;;esac;exit;

And the preceding string '(p(\' gets another ( to balance out the ) in the 3rd case definition.

That’s the easy part. Now how did we include it?

Japt

I confirmed @ais523’s assertion that that there is a parser bug in that unmatched [’s will cause Japt not to parse the anything after the [. And according to @ETHproductions, this bug has possibly existed since he wrote the parser (late 2015 – early 2016). So, this “feature” is in bounds for this polyglot. So, how do we exploit it?

For starters the bracket has to be closed for other languages, but hidden from being closed for Japt. The technique that I stumbled into solved this right off the bat, uses ' to take the next character as a string so ['] opens the bracket, takes ] as a string which is never transpiled to JavaScript.

Pip needed the backtic based string still, and that got moved to line 4 (more on that later). I believe Japt also still sees the backtic string, and considers every ] therein to be part of the string and not a closing bracket. So, the only rule we have to follow is to not put 2 closing brackets between ['] and the start of this string on line 4. Not a big cost.

Next, Japt’s existing answer (1|6$) has lived on the last line of the polyglot for as long as I remember, but now that we’re not transpiling past line 2, we need to move this. Currently, line 1 is dominated by C’s preprocessor directive syntax, not to mention all the 2D languages that have to traverse the space. All these competing needs mean that Japt must conclude on line 2 and line 2 must start with #/* in order to remain hidden from the scripters and to initiate C/C++ block comment. So that’s where we begin.

# tells Japt to take the ascii value of the next character: /. This instruction breaks up the block comment syntax which gets passed to JavaScript as 47*. Since, 47 is prime and therefore not easily multiplied by some fractional x to arrive at 7, I chose to multiply by zero and then add in the 7. I pulled the same trick as found at in the prior answer to sum 0 and 7 like so: #/*0|7.

From here, it would be preferable to immediately go into our parsing error to hide the rest of the polyglot, but #/*0|7 ['] transpiles to 47*0|7,, and that comma make for an unexpected end of input error (if you run this as stand-alone), so we obfuscate the transpolation with a Javascript comment. Remember, this still means that the ['] is parsed and transpiled, but Javascript will choose not to act on it come run time, because it is in fact a comment.

So, #/*0|7//['] gives us everything we need to answer with Japt and effectively kill it. But as always the devil’s in the details.

Pyth

Pyth is another language that attempts to parse the whole polyglot, even though we tell it to quit in line 1. For Pyth we hide the bulk of the polyglot in the double quote that starts on line 2 which we only occasionally dip out of for things like Python’s multi-line string decleration. Pyth didn’t like to parse the Japt bracket solution, so the " had to go before the brackets. But the brackets can’t exist from within a string from Japt’s perspective if we want to bug the parser. So, for Pyth, we add `"` which Japt sees a single character, backtic string, and Pyth sees a long double quote string.

Pip

Pip similarly did not like the bracket attack, but Pip like Japt recognizes the backtic as a string declaration, so we had to go a different route. Currently line 1 is obscured form Pip by way of a double space, line comment immediately following the 16, so we just do the same here prior to the Japt brackets then enter the backtic string as soon as Labrynth would allow.

Underload/Trigger/Prelude/Whitespace/Whirl/Incident

With all the space being taken up by Pip/Pyth/Japt on line 2, and the rigid requirements of the the Befunges to align their line 2 code with their line 1 code paths, some stuff had to move out of the beginning of line 2. Trigger got moved to the end of the Pyth string in line 1 where the Pyth quit statement resides. Underload got moved for the same reason, landing back near its previous home, towards the end of line 2.

The 0 thrown into the beginning of line 2 caused one of Whirl’s IPs to spin CCW instead of CW. So I had to correct the spin and position later in line 2 with an extra 10111. The order of these instructions remains, but the characters are not consecutively placed any longer because of Prelude and Incident. (you could maybe save a byte by refactoring the whirl/Incident/cow line, but ain't nobody got time for that.)

Incident didn’t like the Whirl fix because it caused 10 and 01 to become tokenized and then overlap with some business tokens on the incident line causing the lot of them to de-tokenize, so the whirl insert had to get chopped up. Also, Underload’s move caused some parenthetic reshuffling for Prelude.

All of these needs plus the flexibility of Whitespace caused line 2 to shake out to look like this:

#/*0|7//`"`['][!(>77*,;68*,@;'1,@1␉0␉␉11)(22)S␉(1 P''53'S^'q

Brain-Flak/Classic & C/++ & Octave

Finally, with all the curly brace requirements of Japt removed, I looked back through the history for all the Japt appeasing moves that have taken place and undid them.

The Bran-Flak business string now looks like this:{}{}{}{}({}<(((((()()())){}{})){}{})>)\{(<{}(({}){})>)}{}({}()) requiring only a single backslash to appease only Thutu.

The C/C++ “puts” line now looks much more reasonable like this #*/{puts(p);}/*.

And finally, the Octave+(Brain-Flak's stack-shell-game) looks like this:

<>{//
#}
disp 49#//
#{
}<>//

Oh, I also took the @ out of line 1. I never knew why I needed it, and it seems I don't today. /shrug.

Test Driver Changes

I added a few more special outputs for displaying an easier to read version of Brain-Flak, Whirl and BF/SMBF code. Enjoy.

I may have made a couple other tweaks to the driver/polyglot that I'll only remember come Monday, so I'll probably add a little more later. But this is all I got for today.

Thanks and good luck.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Very, very cool. It's awesome to see how far this has come already and imagine where it will go in the future :-) I find it impressive that changing the structure of the Japt code allowed for so much reduction in size. If it helps any, you can use a semicolon to safely separate the return value from the un-parsed array: 7;['] <whatever> transpiles to just 7; which returns 7 when evaluated. \$\endgroup\$ Commented Apr 29, 2017 at 0:29
  • \$\begingroup\$ Please use <code> tags instead of ` for #/*0|7//`"`['][!(>77*,;68*,@;'1,@1␉0␉␉11)(22)S␉(1 P''53'S^'q \$\endgroup\$ Commented Apr 29, 2017 at 1:26
  • \$\begingroup\$ @ETHproductions I actually tried ; in that spot, but had some kind of problem. Don't remember what it was now though. I might poke at it again a bit later. \$\endgroup\$
    – Chance
    Commented Apr 29, 2017 at 2:09
  • 1
    \$\begingroup\$ Btw I don't know if you want to golf this anymore but I am next to certain the # at the end of the second to last line is unnecessary. \$\endgroup\$
    – Wheat Wizard
    Commented Apr 29, 2017 at 4:06
  • \$\begingroup\$ @WheatWizard You're totally right! I'll leave it for the next post. I kinda don't like to make golfing edits after posting an answer. I'm always feel like I'm creating version issues for someone else. \$\endgroup\$
    – Chance
    Commented Apr 29, 2017 at 4:32
11
\$\begingroup\$

68. Python (1.6.1), 1698 bytes

#16  "(}o+?23!@)-("//*\Dv;'[af2.q]PkPPX'#CO)"14";n4
#/*0|7//```"`   [-'v][!(>77*,;68*,@;'1,@10␉␉11)(22)S␉␉(1 P''53'S^'q
#>␉
# 36!@␉`
#
#_>++++.>++++++::@-----x-.+?
#`<`
#<]}} +<[<.>>-]>[
#{
#z}
#
#=x<R+++++[D>+++++++59xL+++<-][pPLEASE,2<-#2DO,2SUB#1<-#52DO,2SUB#2<-#32DOREADOUT,2PLEASEGIVEUPFACiiipsddsdoh]>@@+.---4O6O@.>][
#
#x
#x%+>+=ttt Z_*.
#D>xU/-<+++L
#R+.----\).>]|
#[#[(?2?20l0v0x1k1kMoOMoOMoOMoOMOO0l0ix0jor0h0h1d111x0eU0yx0y0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k1x0vx0v0l111111^_00)
[ "]56p26q[puts 59][exit]" ,'\[' ];#/s\\/;print"24";exit}}__DATA__/
#
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.
#
'((( p\';a=a;case $argv[1]+${a:u} in *1*)echo 50;;*A )echo 54;;*)echo 58;;esac;exit;';print((eval("1\x2f 2")and 9or 13<<(65)>>65or 68)-(0and 4)^1<<(65)>>62)or"'x"or' {}{}{}{}({}<(((((()()())){}{}) ){}{})>){(<{}(({}){})>)}{}({}())wWWWwWWWWwvwWWwWWWwvwWWWwWWWWWWWWwWWWWwWWWWWWWwWWWWWWWW li ha '#}#( prin 45)(bye)46(8+9+9+9+9+=!)((("'3)3)3)"'
__DATA__=1#"'x"
#.;R"12"'
###;console.log 39
""""
=begin
<>{nd
#sseeeemPaeueewuuweeeeeeeeeeCis:ajjap*///;.int 2298589328,898451655,12,178790,1018168591,84934449,12597/*
#define u8 "38\0"
#define p sizeof'p'-1?u8"67":"37"
#include<stdio.h>
main ( ){puts( p);}/*
print 61
#}
disp 49;
#{
}<>
$'main'3
#-3o4o#$$$
#<T>"3"O.s
=end
"""#"
#}
#sx|o51~nJ;#:p'34'3\=#print(17)#>27.say#]#print (47)#]#echo 21# xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi xi ax fwwvwWWWwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwvwWWwwwwwwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwvm 
# sss8␛dggi2␛`|$// ''25  16*///~-<~-<~-<<<~-XCOprint("65")#s^_^_2229996#

VIP score (Versatile Integer Printer): .005400 (to improve, next entry should be no more than 1773 bytes)

Try it online!

Rundown

This program prints 1 in Python 3, 2 in V/Vim, 3 in Minkolang, 4 in ><>, 5 in Python 2, 6 in SMBF, 7 in Japt, 8 in Retina, 9 in Perl 5, 10 in Befunge-93, 11 in Befunge-98, 12 in Fission, 13 in Ruby, 14 in Turtlèd, 15 in Haystack, 16 in Pyth, 17 in Julia, 18 in Cardinal, 19 in Reng, 20 in Prelude, 21 in Nim, 22 in Underload, 23 in Hexagony, 24 in Thutu, 25 in Pip, 26 in 05AB1E, 27 in Perl 6, 28 in Brain-Flak, 29 in Trigger, 30 in Whitespace, 31 in Modular SNUSP, 32 in Whirl, 33 in Incident, 34 in Rail, 35 in INTERCAL, 36 in Labyrinth, 37 in C++, 38 in C99, 39 in CoffeeScript, 40 in Minimal-2D, 41 in brainfuck, 42 in evil, 43 in reticular, 44 in alphuck, 45 in PicoLisp, 46 in Cubix, 47 in Lily, 48 in Deadfish~, 49 in Octave, 50 in Bash, 51 in Assembly, 52 in COW, 53 in Shove, 54 in Zsh, 55 in Brain-Flak Classic, 56 in dc, 57 in Wise, 58 in Ksh, 59 in Tcl, 60 in Moorhens, 61 in S.I.L.O.S, 62 in Grass, 63 in Brian & Chuck, 64 in Agony, 65 in ALGOL 68, 66 in Surface, 67 in C11 68 in Python

Verification

Most languages can be tested with the test driver above, but 6 languages have to be tested locally.

  • Reng can be tested to output 19 here.

  • Modular SNUSP can be tested to output 31 here.

  • Incident was verified to test 33 locally.

  • Deadfish~ can be tested to output 48 locally, using this interpreter. Note that Deadfish~ takes the polyglot to be fed on stdin, but and prints a number of >> prompts to standard output, which are n unavoidable consequence of running any Deadfish~ program.

  • Moorhens 2.0 can be tested to output 60 using this interpreter.

  • Surface can be tested to output 66 using this interpreter run using Wine (It probably works on Windows but Windows is not a free software, so it would be forbidden for this challenge (I also don't have it so I can't test it anyway))

Explanation

We already had two versions of python so I thought, why not add a 3rd.

The first thing Python took issue with was "1\x2f2". It parses \x2f2 as one character instead of two separate characters. In order to remedy this I inserted a new space between f and 2. Now Python outputs 13 as if it were Ruby. This meant I wanted to separate it from Ruby and Python 2, making 68 instead of 13.

To do this we rely on python's limited precision, not present in Ruby or Python 2. In ruby or python2:

13<<65>>65

Is just 13, but in python it is 0. We use this to short circuit an or causing Python to get a 68 instead of a 13.


Ok so what did I break? Surprisingly not much. When I ran this in TIO the only thing that broke was Brain-Flak Classic.

Brain-Flak Classic

Brain-Flak Classic had a problem with <<>>. This is a stack switch and caused Classic to get caught in a loop. We could remedy this by placing parentheses around 65, this will cause the <<>> to become <<()>> which is a noop.

Prelude

Fixing Brain-Flak broke prelude again. I added a space to counteract the movement caused by fixing Brain-Flak.

\$\endgroup\$
1
  • \$\begingroup\$ I confirm that it works in surface on windows (no null bytes). \$\endgroup\$
    – stasoid
    Commented Jun 5, 2017 at 20:33
11
+500
\$\begingroup\$

128. Haskell, 4904 bytes

#16  "?63(o?23!*# #@"/*"r"{\Dv;'[af2.q]PkPPX)\('#CO"14"   ^; */
#/*0|7//```"`  [>.>.])[-'][(x>77*;,68*,@,1',;# l1011)(22)/ \S \7aa*+42@n;iiipsddpsdoh coding=utf8␉␉␉␉(1P''53'S^'?????!?!??!??!!!!???!?!??!!?!?!!!!!?!!!!?????!????????????????????!) (qx
#>␉xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_xxxOBxxxxxV/112\n
# 36!@␉`  e++++++::@    / "78"oo@xxxx h#115 o# doxe b xx-----
#cxx#z#111#y#y#y#_#11111xx 
#~==++++++++++++++++++++++++++++++++++++++++x+++++++++.._+++++++.
#`<`============================================================
#<<<#>>]}}+-[.^+.._]+-+<[<<.>>x>-]>[
#{
#x}
#2""/*\*
#=x<R+++++[D>+++++++q       L+++<-][PLACET,2<-#2FAC,2SUB#1<-#52FAC,2SUB#2<-#32FACREADOUT,2PLEASEGIVEUPFACs]_>@@+.---@.>][
#x%+>+=ttt Z_*.                              _         _              _
#D>xU/-<+++L    _
#R+.----\   \).>]|
#[#[(?2?20l0v01k1kMoOMoOMoOMoOMOO0l0ix0jor0h0h1d111x0eU0y0yx0moO1d0y0e0e00@O6O4/m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i000x1k1x0vx0v0l111111^_0    )0\\
[ "`e```.1'.0'.6''i]56pq{}26q[puts 59][exit]" ,'_\[999'];#/s\\/;print"24";exit}}__DATA__/
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.<!\
'(wWWWwWWWWwvwWWwWWWwvwWWWwWWWWWWWWwWWWWwWWWWWWWwWWWWWWWWwwwwvwWWWwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwx                      (([5]{})))␉\';';print(( eval("1\x2f 2") and 9or 13<< (65)>>65or 68)-(0 and eval("\"ppp\".bytes.class==Array and 4or(\"ar_\"[2]==95 and 5-96 or-93)"))^1<<(65)>>62) or"'x"or' {}{}{}{}{}{}{}({}<(((((()()())){}{})){}{})>)(({})5){}x{(x<(<()>)({})({}<{}>({}){})>){({}[()])}}({}){}({}()<()()()>)wWW no no no no no no no no no no no no no no no no no no no no no no no no no no os sp '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("3'3)))"'a'[[@*3*74[?]*]*(<*.*\>]xxxxxxxxxxxxx)'# \\
__DATA__=1#"'x"
#.;R"12"'
###;console.log 39;              '_(*****************819+*+@[*99[?]*]***|!  )'
#\\
""""#\
' ( <><        (          )>  ){ ({}[()]  )}{\';      a=$(printf \\x00    ) ;b=${#a};#\\
" }"';           ((   ( (';case "{"$ar[1]"}"${b} in *1)echo 54;;*4)echo 78;; *1*)echo 50;;*) echo 58;;esac;exit;#(((('))))#\
=begin
#p             +555/2+55x%6E2x
;set print "-";print 89;exit# ss9
utpb now 70 dollar off!
utpb has been selling out worldwide!
#9999 9seeeemPaeueewuuweeeeeeeeeeCis:aj (japppppp😆😨😒😨💬95💬👥➡😻😹😸🙀🙀😹😼😿🙀🙀😼😼😸🙀🙀🙀🙀
👋🔢🌚🌝🌝🌚🌚🌚🌚🌚▲▲▲²²²²▲¡▼¡▲▲¡
😊♈💖
😇♈♈
😊♉♈ +-------+
😇♈♈ |$0011 \|
😇♈♉ |/1000 /|
😇♈💜|\ 0011\|
😊♉♈ |/01 00/|
😊📢♈|\ 0011\|
😈♈💜|@ 0110/|
😊📢♈|       |
😇♉💞+-------+
😊📢♉
7 UP
7 RIGHT
7 RIGHT
7 TEACH
6 BOND
6 BOND
6 BOND
5 RIGHT
5 LEFT
5 RIGHT
7 BOND
7 TEACH
5 TEACH
6 YELL
5 TEACH
6 YELL
6 YELL
You can see a y and a x here. <><

>{-<
>SET y TO 88. <
>SET x TO 32. <

>PUT x IN y. <
>X y. PPVs""o<
>-}

set ! 57,,...,,.,,..,,,,,,..,,,.$^
set ! 51.                         #
More 91 of thiset of re9 red down one blue up red down one blue up red up one red right two blue up ssswwwWWWwWWWWWwWWWWWWWwWWWWWWWWW
How much is it*/
#if 0
.int 2298589328,898451655,12,178790,1018168591,84934449, 12597
#endif//*
#1"" //*
#include<stdio.h>
#define␉ x(d)␉#d
#define u8 "38\0 "//"
char*x[]={"23 7 20 1 ",
# define _ ,
"z c #0C8302"_"b c #B87A63"_"_ c #0000C0"_"d c #708FB7"_"e c #58007B"_"f c #FFC0FF"_"O c #FFFFFF"_"y c #FFFF00",
"h c #E60001 "_"i c #CAFFFF" _"j c #280000"_"k c  #CA0000"_"l c #E60100"_"m c #CA007F"_"n c #330001 "_"q c #E60000",
"c c black", "g c green","x c blue","o c magenta",
"fheyyyyyyyyyyyyyyyyyyyz",
"fibyyyyyyyyyyyyyyyyyyyz",
"fjbyyyyyyyyyyOyOdObOOOO",
"fkggyyyyyyyygOOOOOOOOOO",
"flmnqcccccccccccccccccc",
"fffoOOOxxxxx_oOxxx_Oxo_",
"fffOOOOxxxxxOOOxxxOOc__"};//"
int  y(){puts ( sizeof (0,u8)-5?u8"67":*u8""?"37":x( 0'0  "'\"")[9]?"75":'??-'&1? "79":"77" );"21015""6 27""Zingeg-' ?";return 2;}int z=0;int   q(int a,int b){return b;}main(){q(z++,z++)?puts("124"):y  ();}//*/
#1"" /*/

1<2

>main=putStr"128"
#1"" /*/
#if 0
#endif//* --... ...--
/*/
p=sizeof("9( 999 99\"    ) ;print'(''72'')';end! "           );main( ){puts('??-'&1?"101":"92");return(9-9+9 -9);}
#if 0␌
#endif//* rk:start | print: "69" rk:end<9      >5b*:,1-,@
print 61
#}
disp 49 ;9;
#{
}{}<>       K y7g+H           ;
$'main'3x            #     $  |
#-3o4o#$$$
#<T>"3"O._</+++++++>/+++<-\>;+=4C++.---.
#<<<#>>>  /                  44
reg end="";print(85);reg s#+++;+++++++++++++++++++++++++++++++++++++++++++++++++++++.-.
=end
;"""#"#pxxxxcly"78" \++++>/<~#class P{       function:Main(a:String[] )~Nil{83->Print();} }
#}S9^7^8^MUOUOF@0:8:8\\                 _@125iRE
#s|)o51~nJ;#:p'34'3  \=#print(17)#>27.say#]# print(47  ) #]#echo 21 #fWWWWWWWWWWWWWWWwWWWWWWWWWWWWwvm>++++
#s8␛dggi2␛M`|$//''  1$6~-<~-<~-<<<~-COprint("65")#asss^_^_# 
#9 "25"   +/ ppppppp           (x*n*n*n*e*s*s*s*ee*n*n*n*e*sss*e*n*n*n*ee*s*e)*///V222999686#

VIP score (Versatile Integer Printer): .002338 (to improve, next entry should be no more than 5018 bytes)

This program prints 1 in Python 3, 2 in V/Vim, 3 in Minkolang, 4 in ><>, 5 in Python 2, 6 in SMBF, 7 in Japt 1.4, 8 in Retina, 9 in Perl 5, 10 in Befunge-93, 11 in Befunge-98, 12 in Fission, 13 in Ruby 2.4.1, 14 in Turtlèd, 15 in Haystack, 16 in Pyth, 17 in Julia, 18 in Cardinal, 19 in Reng, 20 in Prelude, 21 in Nim, 22 in Underload, 23 in Hexagony, 24 in Thutu, 25 in Pip, 26 in 05AB1E, 27 in Perl 6, 28 in Brain-Flak, 29 in Trigger, 30 in Whitespace, 31 in Modular SNUSP, 32 in Whirl, 33 in Incident, 34 in Rail, 35 in INTERCAL, 36 in Labyrinth, 37 in C++03(gcc), 38 in C99(gcc), 39 in CoffeeScript, 40 in Minimal-2D, 41 in brainfuck, 42 in evil, 43 in reticular, 44 in alphuck, 45 in PicoLisp, 46 in Cubix, 47 in Lily, 48 in Deadfish~, 49 in Octave, 50 in Bash, 51 in Assembly, 52 in COW, 53 in Shove, 54 in Zsh, 55 in Brain-Flak Classic, 56 in dc, 57 in Wise, 58 in Ksh, 59 in Tcl, 60 in Moorhens, 61 in S.I.L.O.S, 62 in Grass, 63 in Brian & Chuck, 64 in Agony, 65 in ALGOL 68, 66 in Surface, 67 in C11(gcc), 68 in Python 1, 69 in rk-lang, 70 in Commercial, 71 in what, 72 in Fortran, 73 in Morse, 74 in Archway, 75 in C++11(gcc), 76 in Trefunge, 77 in C++14(gcc), 78 in dash, 79 in C++17(gcc), 80 in Klein 201, 81 in Klein 100, 82 in Brain-Flueue, 83 in Objeck, 84 in Klein 001, 85 in zkl, 86 in Miniflak, 87 in Alice, 88 in PingPong, 89 in gnuplot, 90 in RunR, 91 in Cood, 92 in C89(gcc), 93 in Set, 94 in Emotinomicon, 95 in Emoji, 96 in EmojiCoder, 97 in Cubically, 98 in Archway2, 99 in 99, 100 in brainbool, 101 in K&R C(gcc), 102 in Symbolic Brainfuck, 103 in Unicat, 104 in Paintfuck, 105 in Emoji-gramming, 106 in Unlambda, 107 in Gol><>, 108 in Ruby 1.8.7, 109 in DOBELA, 110 in Ruby 1.9.3, 111 in Del|m|t, 112 in Pyramid Scheme, 113 in ADJUST, 114 in Axo, 115 in xEec, 116 in Piet(XPM), 117 in Stones, 118 in MarioLANG, 119 in ImageFuck, 120 in TRANSCRIPT, 121 in Braincopter, 122 in Monkeys, 123 in Mycelium, 124 in C(clang), 125 in Gammaplex, 126 in Nhohnhehr, 127 in Deltaplex, 128 in Haskell

Verification

Try it online!

Languages that are not in the driver:

  • Japt (7) online.
  • Moorhens (60) local. Use moorhens.py from the v2.0-dev branch.
  • Objeck (83) local
  • RunR (90) local
  • Emotinomicon (94) online
  • EmojiCoder (96) online
  • Cubically (97) local
  • Symbolic Brainfuck (102) local
  • Paintfuck (104) online (9x9 grid, origin at top-left)
  • Gol><> (107) local, online
  • Ruby 1.8.7 and 1.9.3 (108 and 110) installed locally using rvm
  • Piet (116) local
  • Stones (117) local
  • ImageFuck (119) local
  • Braincopter (121) local
  • Mycelium (123) local
  • Deltaplex (127) local

Explanation

We’ve been chasing Haskell in polyglot chat for quite some time. It has long seemed an attractive option because it supports literate programming natively. Literate programming is sort of a philosophy that says a program should primarily be written for the benefit of the person reading the code. In Haskell this means that instead of comment blocks, you’d have non-comment blocks. Sound’s attractive right?

Well, not so much.

Haskell seemed to interpret the first line of the polyglot as the same preprocessor directive we’ve all come to love, but then failed on line 2. This seemed like a blocking issue for a long time, until I started looking into Haskell’s option to use C-style preprocessor directive.

Much like FORTRAN, Haskell’s C-preprocessor allowed c-style block comments (/*bla*/), which vastly simplified the insertion process.

Haskell, unlike the other members of the /* comment family only seemed to read start and end comment declarations on lines that start with #. This was a difference that could be leveraged easily enough, so I went back to my documentation in the FORTRAN answer to figure out which languages were commented where.

The insertion point I choose was immediately after the C family languages, where a //*/ was purported to take all the related languages out of their comment state. A careful read of the polyglot up to this point told me that Haskell had still never dropped out of its pre-processor comment, so a #1"" /*/ statement is read by all the languages, and accepted because it is essentially the same directive used on line 1, and the /*/ is a toggle to initiate a comment for everything not in a comment, and to close the comment for the only one left open: Haskell.

So now we have a private place to put our Haskell print statement: >main=putStr"128". The > here is the Bird style literate programming I mentioned earlier to indicate this is code and not comment. Everything else on this line is just a modification of Tio’s “Hello, World!” example.

After this line I wanted to flip all the comments to the state they were in prior to editing. A simple #/*/ would do this, but Haskell protested because of the way the polyglot ends. On the last line with code, we use */// to end the block comment and initiate a line comment to hide the remainder of the code, but Haskell didn’t accept // as a preprocessor comment indicator, and concatenated the before and after of this block as #//, which it declared an error worthy invalid preprocessor declaration. Haskell allows junk code after a valid preprocessor declaration however, so we just needed to change #/*/ to the gold standard directive of #1"" /*/.

Transcript

Ok, now we’ve hidden all the invalid preprocessor directives from Haskell’s pre-parser (Is that a thing? That must be a thing.) But we still had the main parser to deal with. Almost everything is hidden by our commitment to literacy, but Transcript also uses Bird style code declarations, so it had to be dealt with. Fortunately, Transcript didn’t have a problem with being encased in a Haskell comment block. So, with a couple adjustments for Perl and Incident, this:

You can see a y and a x here. <
>SET y TO 88. <
>SET x TO 32. <
>PUT x IN y. <
>X y. PPVs""o

Became this:

You can see a y and a x here. <><

>{-<
>SET y TO 88. <
>SET x TO 32. <

>PUT x IN y. <
>X y. PPVs""o<
>-}

I should also note here that Haskell comments don’t like to touch Haskell code. You need a buffer line between. So, I’m adjusting for that and Retina her as well.

S.I.L.O.S.

Finally, within the Haskell private code block, I had to add a < preceding the > code indicator to balance the symbols for Perl6 and the Flaks. Attempting to put a lone < on the line above worked for everything except S.I.L.O.S.. It saw this as something it should parse, and then crash about. The simple fix was to make the statement into this S.I.L.O.S. parse-able statement: 1<2. So, in total, the main Haskell section is now this:

#1"" /*/

1<2

>main=putStr"128"
#1"" /*/
\$\endgroup\$
6
  • 2
    \$\begingroup\$ I think what happens is that the "literate pre-processor" runs first, stripping away everything except lines starting with # or > (or in LaTeX-style \begin{code} blocks), and that happens before it gets sent to CPP. This would explain why CPP is not parsed on other lines, and also means it could be put on > lines if you want. Also it means you've hidden things from the final normal Haskell parser, not a pre-parser. \$\endgroup\$ Commented Sep 7, 2017 at 2:48
  • \$\begingroup\$ @ØrjanJohansen Testing confirms your thinking. Thanks for the insight! \$\endgroup\$
    – Chance
    Commented Sep 7, 2017 at 4:18
  • \$\begingroup\$ This is impressive. Thanks for adding it. \$\endgroup\$
    – stasoid
    Commented Sep 7, 2017 at 8:07
  • 1
    \$\begingroup\$ runhaskell can accept options for particular phases, -optL passes the option to literate pre-processor (unlit). Unfort-ly, there is curr-ly no way to config unlit to remove lines starting with #, which can be considered a bug 'cause it must remove them according to docs. unlit.c already has necessary var leavecpp which is set to 1 by default, but there is no command line option to change it. \$\endgroup\$
    – stasoid
    Commented Sep 7, 2017 at 8:56
  • 1
    \$\begingroup\$ @ØrjanJohansen Might not be the reason why but the loops cancel thesmselves in Alphuck with putStr. \$\endgroup\$
    – Potato44
    Commented Sep 9, 2017 at 2:21
11
\$\begingroup\$

155. Simula (cim), 7000 bytes

#16  "?63(o+?50;+'51;'# #@"/*"r"{\D-v e-'[fa5.q]PkPPX)\( 9 '#CO"14"^ 92*/
#/*0|7//```"`  [>.>.])[-'][(      7 >77*,68*,@'_          7 )(22)S/ \ 5 \7aa*+42@n; 7 999993 1 7 3 1 8 1 1 55 EEEEEδΘΔΔΔΘΔΘλiiipsddpsdoh k zzzzkf kf k zzzzzd kf k zzzzza kf bfz(coding=utf8␉␉␉␉1P''53'S^'????!?!??!??!!!!???!?!??!!?!?!!!!!?!!!!?????!????????????????????! 
#>c#z#111#y#y#y#_#1111xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/112\␉
# 36!@␉`  e++++++::@          /"78"oo@    h#115 o# do           x-----
#comment afTaTaTa TbTbTbRtRtRtVkVk-VkRcRcRcBkBkBkMbMbMbLzLzxxxxxxxxxxxx8=,
#~==++++++++++++++++++++++++++++++ +++++++++++++++++++.._+++++++.
#`<`============================================================   x
#<<<#>>]}}+-[.^+;;+;;+;;+<>;;+;;+;;+;;;;;;+;;+;;.._]+-+<[<<.>>x>-]>[
#{
#x}
#2""/*\*
#=x<R+++++[D>+++++++              L+++<-][PLACET,2<-#2FAC,2SUB#1<-#52FAC,2SUB#2<-#32FACREADOUT,2PLEASEGIVEUPFACs]_>@@+.---@._+>][
#x%+>+=ttt Z_*.                                    _         _              _
#D>xU/-<+++L
#R+.----._>]|
#[#[(+?+?0l0v01k1kMoOMoOMoOMoOMOOx0l0ix0jor0h0h1d111 0eU0y0yx0moO1d0y0e0e00m1d0i0fx0g0n0n114O6O@MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i000x1k1x0vx0v0l111111^_0   )0\\
[ "`e```.1'.0'.6''i]56pq{}26q[puts 59][exit]" ,'_\[999'];#/s\\/;print"24"; exit}}__DATA__/
###x<$+@+-@@@@=>+<@@@=>+<?#d>;?\:-._++._++++._#/<?\>3-++._6+---2._#</++++++++++++++++++++++++++++++++++++++++++++++++._++._++++++.!\
'(wWWWwWWWWwvwWWwWWWwvwWWWwWWWW\WWWWwWWWWwWWWWW/WW\wWWWWWWWWwwwwvwWW/WwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwx                  (([5]{})))\';';print(( eval("1\x2f 2") and 9or 13<< (65)>>65or 68)-(0 and eval("\"ppp\".bytes.class==Array and 4or(\"ar_\"[2]==95 and 5-96 or-93)"))^1<<(65)>>62) or"'x"or' {}{}{}{}{}{}{}({}<(((((()()())){}{})){}{})>)(({})5){}x{( <(<()>)({})({}<{}>({}){})>){({}[()])}}({}){}({}()<()()()>)wWW no no no no no no no no no no no no no no no no no no no no no no no no no no os sp '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("3'3)))"'a'[[@*3*74[?]*.*]*.*(<\>]xxxxxxxxxxxxxxxxxxx)'# \\
__DATA__=1#"'x"
#.;R"12"'
###;console.log 39; 999;
#\\
""""#\
' ( <><        (         x)>  ){ ({}[( )] )}{\';      a=$(printf \\x00    ) ;b=${#a};#\\
" }"';           ((   ( (';case "{"$ar[1]"}"${b} in *1)echo 54;;*4)echo 78;;*1*) echo 50;;*) echo 58;;esac;exit;#(((('))))#\
=begin
#p            +555!/2+55x%6E2x********>********************828+*+@[*9 9[?]*]*****|!
;set print "-";print 89;exit# ss9 111<e$P+x+x+x+x+x*D*x+x+x+1+x+1E!s
utpb now 70 dollar off!
utpb has been selling out worldwide!
#9999 9 seeeemPaeueewuuweeeeeeeeeeCis:ajjapppppp⠆⠄⡒⡆⡘😆😨😒😨💬95💬👥➡😻😹😸🙀🙀😹😼😿🙀🙀😼😼😸🙀🙀🙀🙀
👋🔢🌚🌝🌝🌚🌚🌚🌚🌚▲▲▲²²²²▲¡▼¡▲▲¡→
밠밠따빠빠맣박다맣받다맣희맣희うんたんたんたんたんうんうんうんうんうんたんうんうんうんたんうんたんたんうんたんたんうんたんたんうんたんたんうんたんたんたんたんたんうんうんうんうんたんたんうんたんたんたんうんうんうんたんうんうんたんうんうんたんうんうんたんうんたんうんうんうんたんたんうんたんたんうんたんたんうんたんたんうんたんたんたんうんうん
😊♈💖
😇♈♈ +-------+
😊♉♈ |$0011 \|
😇♈♈ |/1000 /|
😇♈♉ |\ 0011\|
😇♈💜|/01 00/|
😊♉♈ |\ 0011\|
😊📢♈|@ 0110/|
😈♈💜|       |
😊📢♈+-------+---
😇♉💞
😊📢♉⠀⢃⠛⠋
1  1  ! !
2   !    !
1      !!
1  x*
53  +
1  x*
51  +
1  x*
34  +
15  +                    ?   ?@             !
1   *                   ?@    ?
1   !                     +   *
1                       ?  !  ?
1     !                  ? @ ?
<  <    <<   <  <
< B=  =====  =>8 =
, 8= > B    = =
=  ==  =    = >   8  =
D B    =   D  x   xxx x
` `    =   >  8  = >
 ~ B   =  =   =  = > ~
 B =   D  ~   8 =  > xx
x   x  x x      x  xx  x
x   x    x    xx   x
x    x xx     xx
x    x xx     x
 8=,x  x

7 UP
7 RIGHT
7 RIGHT
7 TEACH
6 BOND
6 BOND
6 BOND
5 RIGHT
5 LEFT
5 RIGHT
7 BOND
7 TEACH
5 TEACH
6 YELL
5 TEACH
6 YELL
6 YELL
Yo::=~147
::=
You can see an x here.<<110[0]{472454523665721469465830106052219449897} 9

>{-<<
>SET x TO 120.
>X x. PPQ-}
>main=print 146{-ss

set ! 57,,...,,.,,..,,,,,,..,,,.$^
set ! 51.                         #"1015""6027""ing-?"ye h m 3 ;p seLz
More 91 of thiset of re9 red down one blue up red down one blue up red up one red right two blue up ssswwwWWWwWWWWWwWWWWWWWwWWWWWWWWW baa baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeeeeet bleeeeeeeeeeeeet bleeeeeeeeeet baaaa bleet bleeeeeeeeeet bleeet bleeeeeeeeeet
How much is it*/
#if 0
.int 2298589328,898451655,12,178790,1018168591 ,84934449, 12597
#endif//*
#1""//*
#include<stdio.h>
#define  x(d) #d
#define u8 "38\0 "//"16
char*x="24 10 31 1"
"a c #FFC0FF""B c #0000C0""d c #58007B""e c #0C8302"
"h c #E60001""i c #CAFFFF""j c #280000""k c #CA0000""l c #CA007F""n c #330001 ""q c #E60000"
"o c #FF8000""t c #FF00BC""u c #008080"
"A c #0040C0""E c #808000""F c #00C040""G c #008000 ""R c #800000"
"H c #0000AA""I c #00AA00""J c #55FFFF""K c #AAAAAA"
"r c red""g c green""b c blue""c c cyan""m c magenta""y c #FFFF00""x c black""_ c #FFFFFF"
"HHHahtdegggggggyrggggggc"
"IHHaixuEFbGGbggbryAEGRgc"
"JJHajyurbgbgggggggb____o"
"IJHakmyyyyyyyyyyyyyyyyye"
"I__almyyyyyyyyyyyyyyyyye"
"K__anmyyyyyyyyyyyyyy_y_e"
"HH_aqggyyyyyyyyg____m_Je"
"JH_axxxxxxxxxxxxxxxxxxxx"
"K__aaaam___bbbbbBm_bbBab"
"K__________bbbbb___bbxbb";//"
int  y(){puts ( sizeof (0,u8)-5?u8"67":*u8""?"37":x( 0'0  "'\"")[9]?"75":'??-'&1? "79":"77" );return 2;}int z=0;int q(int a,int b   ){return b;}main( ){q(z+=1,z)?puts("124"):y();}//<*/
#1""/*/
 
>main=putStr"128"--}
 
#1""/*/
#if 0
#endif//* --... ...--
/*/
p=sizeof("9( 999   99\"  ) ;print'(''72'')';end! ");  main(   ){puts('??-'&1?"101":"92");return(9-9+9 -9);}
#if 0
#endif//* rk:start | print: "69" rk:end 9                 @,-1,:*b5<>␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␌␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␌␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋
print 61
#}
disp 49 ;9;
#{
}{}<>        K yya+-        &  g+$
$'main'3x             A=AgRA;       AC
#-3o4o#$$$
#<T>"3"O._</+++++++>/+++<-\>+++.---.\_<!+++++++++++++++++++++++++++++++++++++++++++++++++._++.-.>@
#<<<#>>>  /
reg end="";print(85);reg s#++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-.
=end
;"""#"#xxxxclou"78" \++++>/<~#class P{function:Main (a:String[]  )~Nil{83->Print();}}
#endcOmment
#nocOmment   outtext("155"   )
#}pS9^7^8^MUOUOF@0:8:8     \\     @,,1'1'<>   _@125iRE
# |o51~nJ;#:p'34'3         \=#print(17)#>27.say#]# print(47)#]#echo 21#WWWWWWWWWWWWWWWwWWWWWWWWWWWWwv>++++
#8M`|   <esc>dggi2<esc>//  $}<}}<}>}[<<}< <<<<}<<}<<<<}<<<}}}<}}<}}<}}<    }}<}}<}}}<}}<<<<<<<<<<<}}}<}}<}}<}}<}}<}}<}}}<<<<<<<<<<}+++++++++++++++++++++++++++++++++++++++++++++++++._++.._#]~-<~-<~-<<<~-<COprint("65")#`=>asss^_^_# 
#9 "25"   +/ppppppp neeeeee*n*n*n*es*s*s*^ee*n*n*n*e*sss*e*n*n*n*ee<*s 5>1  *e*///\)Q222999686#

Try it online!

Simula is an object-oriented extension of ALGOL. Simula does not allow most of non-whitespace controls (link). Before this addition polyglot had only one such character - ESC for V. To get rid of it I used V verbose mode in which <esc> can be used instead of literal ESC character.

Cim Simula compiler (installed on tio) has preprocessor. I used #comment and #endcomment to hide the bulk of polyglot and #nocomment to insert Simula code on a line starting with #. Invalid preprocessor directives are ignored.

Line 5:

#comment af ...

Lines 153/154:

#endcOmment
#nocOmment   outtext("155"   )

To fix evil: removed a before f on the first line, added af after #comment. Removing a from the first line breaks Beatnik, so I just swapped a and f. Capital Os are for ADJUST.

Line 157:

#8M`|   <esc>dggi2<esc>//  ...

Separated Retina from V. Two spaces before <esc> are for Pip, third space is to fix Archway. // after <esc> is for V. Two es in <esc>s are compensated by removing two es from Paintfuck. Two ss are compensated in alphuck by removing ss from lines 156/157 (previously 154/155). One of these ss is skipped by Paintfuck, so we still need to add one n to fix it. Two <s are compensated with two }<} in BitChanger.

Removed $, '' and string of {s from line 157. Small refactoring: 2 + 35 for l33t on the first line.

\$\endgroup\$
2
  • 5
    \$\begingroup\$ That's not just "an object-oriented extension of ALGOL", that's the oldest OO language, period! \$\endgroup\$ Commented Nov 10, 2017 at 3:19
  • 3
    \$\begingroup\$ #comment af ... well that's a pretty good description of this polyglot \$\endgroup\$ Commented Nov 15, 2017 at 21:35
11
\$\begingroup\$

87. Alice, 2448 bytes

#16  "}(o+?23!@- "/*\Dv;'[af2.q]PkPPX)\('#CO"14";*/
#/*0|7//```"`  )[-'][(>77*;,68*,@,1',;# l1011)(22)\4nS ␉;␉␉␉(1P''53'S^'????!?!??!??!!!!???!?!??!!?!?!!!!!?!!!!?????!????????????????????!) (qx
#>␉
# 36!@␉`
#~
#_>++++.>++++++::@---x---.+?
#`<`
#<<<#>>]}}+<[<<.>>x>-]>[
#{
#x}
#2""/*\*
#=x<R+++++[D>+++++++qL+++<-][pPLEASE,2<-#2FAC,2SUB#1<-#52FAC,2SUB#2<-#32FACREADOUT,2PLEASEGIVEUPFACiiipsddsdoh]>@@+.---@.>][
#x%+>+=ttt Z_*.ar4O6O@
#D>xU/-<+++L
#R+.----\).>]|
#[#[(?2?20l0v01k1kMoOMoOMoOMoOMOO/"78"oo@0l0ix0jor0h0h1d111x0eU0y0yx0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k1x0vx0v0l111111^_0)0
[ "]56p26q[puts 59][exit]" ,'\['];#/s\\/;print"24";exit}}__DATA__/
###x<$+@+-@@@@=>+<@@@=>+<?#d>+.--.<
'(wWWWwWWWWwvwWWwWWWwvwWWWwWWWWWWWWwWWWWwWWWWWWWwWWWWWWWWwwwwvwWWWwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWw((.*.*.*.*.*.*.*.*.*.*819.+.*.+@[5]{}) ) )␉\';';print((eval("1\x2f 2")and 9or 13<< (65)>>65or 68)-(0and 4)^1<<(65)>>62)or"'x"or' {}{}{}{}({}<(((((()()())){}{})){}{})>)(({})5){}x{(x<(<()>)({})({}<{}>({}){})>){({}[()])}}({}){}({}()<()()()>)wWW no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no os sp '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("3'3)))"'a'[[@*3*74[?]*]*(<\>@*99[?]*]*.*|!)'#
__DATA__=1#"'x"
#.;R"12"'
###;console.log 39
""""
' (<><       (          )> ){ ({}[()] )}{\';       a=$(printf \\x00    );b=${#a};

" }"';           (( ( (';case "{"$ar[1]"}"${b} in *1)echo 54;;*4)echo 78;; *1*)echo 50;;*)echo 58;;esac;exit;# (((('))))
=begin
utpb now 70 dollar off!
utpb has been selling out worldwide!
#seeeemPaeueewuuweeeeeeeeeeCis:ajjappp*/
#if 0
.int 2298589328,898451655,12,178790,1018168591,84934449,12597
#endif//*
#1"" //*
#include<stdio.h> 
#define ␉l(d)␉#d
#define u8 "38\0\0"
main ( ␉){puts( sizeof (0,u8)-5?u8"67":*u8""?"37":l( 0'0  "'\"")[9]?"75\0":'??-'&1? "79":"77\0");}//*/
#if 0
#endif//* --... ...--
/*/
print'("72")';end;
#if 0␌
#endif//* rk:start | print: "69" rk:end<>5b*:,1-,@
print 61
#}
disp 49;
#{
}{}<>
$'main'3
#-3o4o#$$$
#<T>"3"O.</+++++++>/+++<-\>+++.---.
#<<<#>>>
reg end="";print(85);reg s
=end
;"""#"#yxxxxxxx"78"\++++>/<~#class P{   function:Main(a:String[] )~Nil{83->Print();} }
#}
#s|o51~nJ;#:p'34'3\=#print(17)#>27.say#]#print (47) #]#echo 21#fwwwwwwWWWwWWWWWwWWWWWWWwWWWWWWWWWwWWWWWWWWWWWWWWWwWWWWWWWWWWWWwvm>++++
#s8␛dggi2␛M`|$//''   16~-<~-<~-<<<~-COprint("65")#sss^_^_#
#5 "25"  +/ *///X222999686#

VIP score (Versatile Integer Printer): .003717 (to improve, next entry should be no more than 2533 bytes)

Rundown

This program prints 1 in Python 3, 2 in V/Vim, 3 in Minkolang, 4 in ><>, 5 in Python 2, 6 in SMBF, 7 in Japt, 8 in Retina, 9 in Perl 5, 10 in Befunge-93, 11 in Befunge-98, 12 in Fission, 13 in Ruby, 14 in Turtlèd, 15 in Haystack, 16 in Pyth, 17 in Julia, 18 in Cardinal, 19 in Reng, 20 in Prelude, 21 in Nim, 22 in Underload, 23 in Hexagony, 24 in Thutu, 25 in Pip, 26 in 05AB1E, 27 in Perl 6, 28 in Brain-Flak, 29 in Trigger, 30 in Whitespace, 31 in Modular SNUSP, 32 in Whirl, 33 in Incident, 34 in Rail, 35 in INTERCAL, 36 in Labyrinth, 37 in C++03, 38 in C99, 39 in CoffeeScript, 40 in Minimal-2D, 41 in brainfuck, 42 in evil, 43 in reticular, 44 in alphuck, 45 in PicoLisp, 46 in Cubix, 47 in Lily, 48 in Deadfish~, 49 in Octave, 50 in Bash, 51 in Assembly, 52 in COW, 53 in Shove, 54 in Zsh, 55 in Brain-Flak Classic, 56 in dc, 57 in Wise, 58 in Ksh, 59 in Tcl, 60 in Moorhens, 61 in S.I.L.O.S, 62 in Grass, 63 in Brian & Chuck, 64 in Agony, 65 in ALGOL 68, 66 in Surface, 67 in C11, 68 in Python 1, 69 in rk-lang, 70 in Commercial, 71 in what, 72 in Fortran, 73 in Morse, 74 in Archway, 75 in C++11, 76 in Trefunge-98, 77 in C++14, 78 in dash, 79 in C++17, 80 in Klein 201, 81 in Klein 100, 82 in Brain-Flueue, 83 in Objeck, 84 in Klein 001, 85 in zkl, 86 in Miniflak, 87 in Alice

Verification

Try it Online!

Languages currently not on TIO:

  • Japt, 7 online.

  • Reng, 19 online.

  • Deadfish~, 48 local.

  • Moorhens, 60 local. use moorhens.py from the v2.0-dev branch

  • Morse, 73 local

  • Archway, 74 local

  • Trefunge-98, 76 local. Use -v 98 -d 3 for Trefunge-98.

  • Objeck, 83 local

  • zkl, 85 local

Explanation

Alice is a 2D language created by Martin Ender. As well as the orthogonal movement that most 2D languages have it also has diagonal movement. Although we don't really use it in this program each character performs a different operation depending on whether travel is orthogonal or diagonal. Operations with integers when moving orthogonally and string operations when moving diagonally.

Mirrors (/ and \) are how the IP changes between orthogonal and diagonal movement. This diagram from the github explains in which way they do so:enter image description here

The IP starts in the top left corner travelling East. We travel over some commands that don't do anything besides add junk to the stack until we reach /. This sends the IP South-East which we will go through a couple of other commands that don't do anything important until we reach

/"78"oo@

embedded in the Incident/Whirl/Cow line (The reason it is here and not earlier is because Underload didn't like it earlier). The IP comes into this snippet on the / which changes its direction from South-East to East. The " then puts Alice in string mode. As we are in String mode the 7and 8 don't perform their normal action. The second " then closes string mode; since we are travelling orthogonally this means the ascii values of the characters we passed over in string mode are pushed onto the stack, one number per character. The o command is the output top of stack (truncated to one byte) command. Passing over two of these will output the '8' and then the '7'. @ then ends the program.

Incident

Some of the x just before the archway loop were replaced with "78" to prevent 8" and 78 from becoming tokens

\$\endgroup\$
2
  • \$\begingroup\$ The mirrors behave more like lenses. If they were mirrors, the IP wouldn't go through them. \$\endgroup\$ Commented Sep 27, 2017 at 17:01
  • \$\begingroup\$ @CalculatorFeline I prefer the description Martin gave somewhere. The path the IP follows is like what would happen if you were to hold a stick up to a mirror and came in travelling along the stick and then came out along the reflection of the stick. \$\endgroup\$
    – Potato44
    Commented Sep 27, 2017 at 17:07
11
+100
\$\begingroup\$

170. Haskell with NegativeLiterals, 8944 bytes

#16  "?63(o+?50;+'51;'# #@"/*"r"{\D-v e-'[fa5.q]PkPPX)\( 9 '#CO"14"^ 92*/
#/*0|7//```"`  [>.>.])[-'][(      7 >77*,68*,@'_          7 )(22)S/ \ 5 \7aa*+42@n; 7 999993 1 7 3 1 8 1 1 55 EEEEEδΘΔΔΔΘΔΘλiiipsddpsdoh k zzzzkf kf k zzzzzd kf k zzzzza kf bfz(coding=utf8 1P''53'S^'????!?!??!??!!!!???!?!??!!?!?!!!!!?!!!!?????!????????????????????!
#>c#z#111#y#y#y#_#1111x           -x    xxxxxxxxxxxxxxxxxxxxxxxxx/112\ 
# 36!@ `  e ++++++::@         /"78"oo@    h#115 o# dO           x-----
#comment -[af] tAtAtA TbTbTbRtRtRt-VkVkVkRcRcRcBkBkBkMbMbMbPSPSPSpspspsQhQhQhQrQrQrHnHnHnbqbqbqLzLzLzTcTcTcxxxxx8=,  
#~==++++++  ++++++++++++++++++++++ +++++++++++++++++++++.._+++++++.  
#`<`===============================================================                                             p
#<<<#>>]+-}}[.^+;;+;;+;;+<>;;+;;+;;+;;;;;;+;;+;;.._]}--<^>++[+++++[>+++++++<-]>._++++._+++._^<]+-+<[<<._>>x>-]^>[  
#{  
#cs}  
#2""/*\*  
#=x<R+++++[D>+++++++9999 9 9      L+++<-][PLACET,2<-#2FAC,2SUB#1<-#52FAC,2SUB#2<-#32FACREADOUT,2PLEASEGIVEUPFACs]_>@@+.---@._+>][
#x%+>+=ttt_Z_*.9 999 99 9999 9                     _         _              _
#D>xU/-<+++L_9  
#R+.----._>]| 9 9999
#[#[(+?+?0l0v01k1kMoOMoOMoOMoOMOOx0l0ix0jor0h0h1d111 0eU0y0yx0moO1d0y0e0e00m1d0i0fx0g0n0n11yxMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOotMOo0moo0n0tx0t0moO0fx4O6O@ 0t0gOOM0g0f0h0j0j0i000x1k1x0vx0v0l111111^_0   )000011100\\
[ "`e```.1'.0'.6''i]56pq{}26q[puts 59][exit]" ,'_\['];#/s\\/;print"24"; exit}}__DATA__/
###x<$+@+-@@@@=>+<@@@=>+<?#d>;?\:-._++._++++._#/<?\>3-++._6+---2._#</++++++++++++++++++++++++++++++++++++++++++++++++._++._++++++.>!\
'(wWWWwWWWWwvwWWwWWWwvwWWWwWWWW\WWWWwWWWWwWWWWW/WW\wWWWWWWWWwwwwvwWW/WwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwx                  (([5]{})))\';';print(( eval("1\x2f 2")and(9)or 13<< (65 )>>65or 68)-(0and eval("\"ppp\".bytes.class==Array and(4)or(95==\"ar_\"[2]and 5-96 or-93)"))^1<<(65)>>62) or"'x"or' {}{}{}{}{}{}{}({}<(((((()()())){}{})  ){}{})>)(({})5){}x{( <(<()>)({})({}<{}>({}){})>){({}[()])}}({}){}({}()<()()()>)wWW ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO MU s '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("3'3)))"'a'[[@*3*74[?]*.*]*.*(<\>]xxxxxxxxxxxxxxxxxxx)'# \\
__DATA__=1#"'x"  
#.;R"12"'  
###;console.log 39; 
#  \\
""""#  \
' ( <><        (         x)>  ){ ({}[( )] )}{\';      a=$(printf \\x00        ) ;b=${#a};#\\
" }"';           ((   ( (';case "{"$ar[1]"}"${b} in *1)echo 54;;*4)echo $((19629227668178112600/ 118248359446856100));;    *1*)echo 50;;*)echo 58;;esac;exit;#( (((') )))#\
=begin  
#p            +555!/2+55x%6E2x!<******>**********************828+*+@[*99[?]*]*****|!
;set print "-";print 89;exit#ss       e$P+ + + + + *D* + + +1+ +1E!s
p now 70 dollar off!
p has been selling out worldwide!
[mxf]-main=-[165]-###jxf  
#  
seeeemPaeueewuuweeeeeeeeeeCisajjappppppxf⠆⠄⡒⡆⡘😆😨😒😨💬95💬👥➡😻😹😸🙀🙀😹😼😿🙀🙀😼😼😸🙀🙀🙀🙀
👋🔢🌚🌝🌝🌚🌚🌚🌚🌚▲▲▲²²²²▲¡▼¡▲▲¡→  
밠밠따빠빠맣박다맣받다맣희맣희うんたんたんたんたんうんうんうんうんうんたんうんうんうんたんうんたんたんうんたんたんうんたんたんうんたんたんうんたんたんたんたんたんうんうんうんうんたんたんうんたんたんたんうんうんうんたんうんうんたんうんうんたんうんうんたんうんたんうんうんうんたんたんうんたんたんうんたんたんうんたんたんうんたんたんたんうんうん  
😊♈💖  
😇♈♈  
😊♉♈  
😇♈♈  
😇♈♉  
😇♈💜  
😊♉♈  
😊📢♈  
😈♈💜  
😊📢♈  
😇♉💞  
😊📢♉⠀⢃⠛⠋  
#-49,A,-1                              #
#-5,A,-1                               #
#6,A,-1                                #
1     ! !
2   !    !
1      !!
1  x*
53  ++-------+
1  x*|$0011 \|
51  +|/1000 /|
1  x*|\ 0011\|
34  +|/01 00/|
15  +|\ 0011\|           ?   ?@       _     !
1   *|@ 0110/|          ?@    ?
1    |      +|            +   *
1   !+-------+---       ?  !  ?
1    !                   ? @ ?
<  <    <<   <  <
< B=  =====  =>8 =
, 8= > B    = =
=  ==  =    = >   8  =
D B+  +=   D  x   xxx x
` `  + =   >  8  = >
 x ~   B  =   =  = = > ~
 B +   =  D+  ~ 8  = >x
x   x  x x      x  xx  x
x   x    x+   xx   x + +  +    +    +
x    x xx     xx                +++   +
x+  +x +x     x + +      +  +
 8=+,  _         +    +   +         +
   +     +                +  +    +
 +             +  +  +      + + +    +
   +    +      +           +
   +    +      +          +    +      +
   +           +            +
   +      +  + +            +
   +       +   +            +
          +    +            +
# +   +                  +
#+     +     ++  +     +     +
#  +      +     +
+#
  *   +
  *+*

   *************************************************+
# +  +
#          +                                       +
   +    + *
         *****+
# +       +
#   +        +
  * *
   +*****
#        +
   ( printout t 164         )
(exit  )  
#cepp  
MsgBox(0,"",169                     )
#cs  
Yo::=~147
::=  
You can see an x here.<<<<

>{-<<  
>SET x TO 120. [0]{472454523665721469465830106052219449897}
>X x. PPQ-}
>x--/2  
> =157;y=146--/2 
>main=print y{-ss 

\begin{code}  
{-x   ␉␉␉␉ 
␉
 ␉  



-}
open import IO;main = run         (putStr"159"   ) --s
\end{code}
pppppppppppp
Take Northern Line to Tooting Bec
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Embankment
Take Bakerloo Line to Embankment
7 UP
Take Northern Line to Mornington Crescent
7 RIGHT
7 RIGHT
7 TEACH
6 BOND
6 BOND
6 BOND
5 RIGHT
5 LEFT
5 RIGHT
7 BOND
7 TEACH
5 TEACH
6 YELL
5 TEACH
6 YELL
6 YELL
set ! 57,,...,,.,,..,,,,,,..,,,.$^
set ! 51.                         #"6027"1,_ye do{--}gibe16"124"&#8+*sizeString tnd xfmain=9717 96lo
More 91 of this red down one blue up red down one blue up red up one red right two blue up ssswwwWWWwWWWWWwWWWWWWWwWWWWWWWWW baa baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeeeeet bleeeeeeeeeeeeet bleeeeeeeeeet baaaa bleet bleeeeeeeeeet bleeet bleeeeeeeeeet
How much is it*/
#if 0
.int 2298589328,898451655,12,178790,1018168591,84934449,12597
#endif//*
#1""//*
#include<stdio.h>
#define  x(d) #d
#define u8 "38\0 "//"
char*x="24 10 31 1"
"a c #FFC0FF""B c #0000C0""d c #58007B""e c #0C8302"
"h c #E60001""i c #CAFFFF""j c #280000""k c #CA0000""l c #CA007F""n c #330001 ""q c #E60000"
"o c #FF8000""t c #FF00BC""u c #008080"
"A c #0040C0""E c #808000""F c #00C040""G c #008000 ""R c #800000"
"H c #0000AA""I c #00AA00""J c #55FFFF""K c #AAAAAA"
"r c red""g c green""b c blue""c c cyan""m c magenta""y c #FFFF00""x c black""_ c #FFFFFF"
"HHHahtdegggggggyrggggggc"
"IHHaixuEFbGGbggbryAEGRgc"
"JJHajyurbgbgggggggb____o"
"IJHakmyyyyyyyyyyyyyyyyye"
"I__almyyyyyyyyyyyyyyyyye"
"K__anmyyyyyyyyyyyyyy_y_e"
"HH_aqggyyyyyyyyg____m_Je"
"JH_axxxxxxxxxxxxxxxxxxxx"
"K__aaaam___bbbbbBm_bbBab"
"K__________bbbbb___bbxbb";//"
int f(char*a,char*b    ){  puts(a?"124":sizeof(0,u8)-5?u8"67":*u8""?"37": x( 0'0  "'\"")[9]?"75":'??-'&1? "79":"77"  );}main(){f(x,x=0);}//<*/
#1""/*/

>data B=B Integer--WWWWWWWWWWWWWW<<W<p
>instance Eq B where{-[ppWWWWWWWWWWWWay Uce stagehere]-}(B a  )==  (B b)=a==b
>instance Num B where{ fromInteger=B;negate  ( B a             )=B$a+1}
>main=print$last$169+1:[128|B 2==head  [(-1 )::B]]--}


#1""/*/
#if 0
#endif//* --... ...--
/*/
p=sizeof(" (\");   print'(''72'')';end!" );main(){    puts('??-'&1?"101":"92");return 0;}
#if 0
#endif//* rk:start | print: "69" rk:end                   @,-1,:*b5<>␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␌␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␌␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋
print 61
#}
disp 49
#{
}{}<>        K yya+-        &  g+$
$'main'3x             A=AgRA;       AC
#-3o4o#$$$
#<T>"3"O._</+++++++>/+++<-\>+++.---.\_<!+++++++++++++++++++++++++++++++++++++++++++++++++._++.-.>@
#<<<#>>>  /
reg end="";print(85);reg s#++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-.
=end
;"""#"#xxxxclou"78"<\++++>/<~#class P{function:Main (a:String[]  )~Nil{83->Print(); }}
#endcOmment
#nocOmment   outtext("155"   )
#ce pS9^7^8^MUOUOF @0:8:8  \ @,,1'1'<> @125iRE
# |o51~nJ;#:p'34'3         \=#print(   size([[1] [3]][1,:] )[1]==2?158+4:17 )#>say 27#p>>>say 170-3#]#print(47)#]#echo 21#v>++++
#8M`|   <esc>dggi2<esc>//  $}<}}<}>} [<<}<<<<<}<<}<<<<}<<<}}}<}}<}}<}}<    }}<}}<}}}<}}<<<<<<<<<<<}}}<}}<}}<}}<}}<}}<}}}<<<<<<<<<<}+++++++++++++++++++++++++++++++++++++++++++++++++._++.._#]~-<~-<~-<<<~-<COprint("65")#`=>ass^_^_#
#9 "25"   +/ppppppp  ggeeee*n*n*n*es^*s*s*ee*n*n*n*e*sss*e*n*n*n*ee<*s 5>1  *e*///\)Q222999686#

VIP score (Versatile Integer Printer): .001820 (to improve, next entry should be no more than 9100 bytes) Try it online!

Explanation

The new language is the same old Haskell we used before, except with the language extension NegativeLiterals enabled. The negative literals extension is pretty simple it makes it so that when Haskell is desugaring negative literals it applies fromInteger.negate instead of applying negate.fromInteger. Usually this doesn't make a lick of difference to the way a Haskell program behaves, however thanks to this SO answer we can use split the two versions of Haskell.

>data B=B Integer deriving Eq
>instance Num B where{fromInteger=B;negate(B a)=B$a+1}
>main=print$last$170:[128|B 2==((-1)::B)]

This prints 128 normally and 170 when NegativeLiterals is enabled. I replaced the existing code with this.

Grass

This program would have added vw to grass, which is not something we could afford. I was able to remove the v by not deriving Eq

>data B=B Integer
>instance Eq B where(B a)==(B b)=a==b
>instance Num B where{fromInteger=B;negate(B a)=B$a+1}
>main=print$last$170:[128|B 2==((-1)::B)]

however this added another w making the code as read by Grass ww. ww is a bit easier to work with than vw because v is a delimiter and thus is really hard to add to the program. In order to make ww work I had to move all of the remaining Grass into the Haskell program.

>data B=B Integer--WWWWWWWWWWWWWWW
>instance Eq B where(B a)==(B b)=a==b--WWWWWWWWWWWW
>instance Num B where{fromInteger=B;negate(B a)=B$a+1}
>main=print$last$170:[128|B 2==((-1)::B)]

There were only two remaining ws so we are all out now, if more are needed some creativity is going to be required.

Balancing act

The insertion of this code caused a few languages to have unbalanced parentheses. In particular the Brain-Flak family are upset by the >s used to make the Haskell literate and the ss upset alphuck. Fixing this one was pretty simple we just add the relevant open parens

>data B=B Integer--WWWWWWWWWWWWWWW<<<ppp
>instance Eq B where(B a)==(B b)=a==b--WWWWWWWWWWWW
>instance Num B where{fromInteger=B;negate(B a)=B$a+1}
>main=print$last$170:[128|B 2==((-1)::B)]

Prelude

Prelude of course had a problem with me adding parentheses to the code. In order to fix this I first tried to minimize the parentheses I used. All in all I was only able to remove one pair of parentheses by changing (...) to last[...] this made the code

>data B=B Integer--WWWWWWWWWWWWWWW<<<ppp
>instance Eq B where(B a)==(B b)=a==b--WWWWWWWWWWWW
>instance Num B where{fromInteger=B;negate(B a)=B$a+1}
>main=print$last$170:[128|B 2==last[(-1)::B]]

From here I just started adding the relevant whitespace.

>data B=B Integer--WWWWWWWWWWWWWWW<<<ppp
>instance Eq B where                                    (B a  )==  (B b)=a==b--WWWWWWWWWWWW
>instance Num B where{fromInteger=B;negate   ( B a             )=B$a+1}
>main=print$last$169+1:[128|B 2==head  [(-1 )::B]]--}

Now since this just needs to be spacing I was able to move parts of the comments into this space to reduce the size of the code

>data B=B Integer--WWWWWWWWWWWWWWW<<<p
>instance Eq B where{-ppWWWWWWWWWWWW-}                  (B a  )==  (B b)=a==b
>instance Num B where{fromInteger=B;negate   ( B a             )=B$a+1}
>main=print$last$169+1:[128|B 2==head  [(-1 )::B]]--}

Incident Incidents

I had quite the struggle with Incident in this case, but I was able to get everything in order, in the end my code came out like:

>data B=B Integer--WWWWWWWWWWWWWW<<W<p
>instance Eq B where{-[ppWWWWWWWWWWWWay Uce stagehere]-}(B a  )==  (B b)=a==b
>instance Num B where{ fromInteger=B;negate  ( B a             )=B$a+1}
>main=print$last$169+1:[128|B 2==head  [(-1 )::B]]--}
\$\endgroup\$
3
  • \$\begingroup\$ I think something similar to data B=B Int;instance Num B where fromInteger _=B 170;negate _=B 128 and B x= -1;main=print x might shorten this (and make the Eq instance unnecessary.) \$\endgroup\$ Commented Jan 18, 2018 at 3:03
  • \$\begingroup\$ Might also be able to replace B with the use of lists. \$\endgroup\$ Commented Jan 18, 2018 at 3:41
  • \$\begingroup\$ @ØrjanJohansen If I were to do this again I would probably do something like data B=B{u::Integer}, which would give me the function u this would reduce the need for parens (shortening the code drastically) and would mean I don't need it to be an instance of Eq. However at this point things are very fragile so I probably won't be changing the way it works unless I'm already making edits to that section of the code. \$\endgroup\$
    – Wheat Wizard
    Commented Jan 18, 2018 at 3:45
11
\$\begingroup\$

181. Ropy, 10000 bytes

#16  "?63(o+?50;+'51;'  # #@ " /*"r"{\D-v e-'[fa5.q]PkPPX)\( 9 '#CO"14"^ 92                                       7 222222222222222222222222                                                             ##*/
#/*1&7//```"`    [>.>.]      )[-'][(7   >77*,68*,@'_      7 )(22)S    / \iiipsddpsdoh#####(#######??   #### ##  ######     ####         ###### # ####  #######     ####         ###### # ####  #######  a5# \7aa*+42@n; 7 999993 1 7 3 1 8 1 1 55 EEEEEδΘΔΔΔΘΔΘλa k zzzzkf kf k zzzzzd kf k zzzzza kf bfz coding=utf8 p''53'S^'
#>c#z#111#y#y#y#_#1111x18&1&          -xxxxxxxxxxxxxxxx              /112\     ##### #######   # #    #####  #   #   #    ##### ####  ###   #### #  # #####  #    ##### ####  ###   #### #  # #####  #    #
# 36!@ `  e ++++++::@             /"78"oo@  h#115 o# dO 8=,_        x-----x ########    ## ### ###### ######## #### ##### ####### ##### ###    # # #### ### ##### ####### ##### ###    # # #### ### ##### #
#comment -[af] tAtAtA TbTbTbRtRtRtVkVk-VkRcRcRcBkBkBkMbMbMbPSPSPSpspsps      # ##########  ### ## #####  ## #### ## # #####  ## ##### ####   ##### ## # ##  ## ####  ## ##### ####   ##### ## # ##  ## ####
#~==++++++  ++++++++++++++++++++++++++ +++++++++++++++++.._+++++++._         #  ????!?!??!??!!!!???!?!??!!?!?!!!!!?!!!!?????!????????????????????!                                                           
#[#[===============================================================]]        #
#<<<#QhQhQhQrQrQrHnHnHnbqbqbqLzLzLzqTqTqTTcTcTc                              #
##############################################################################                                      p
 #-]+-}}[.^x+;;+;;+;;+<>;;+;;+;;+;;;;;;+;;+;;.._]}--<^>++[+++++[>+++++++<-]>._++++._+++._^<][4O6O@]+-+<[<<._>>x>-]^>[  
#{  
#cs}  
#  
#**  
#2""/*\*  
#=x<R+++++[D>+++++++9999 9 9          L+++<-][PLACET,2<- #2FAC,2SUB#1<- #52FAC,2SUB#2<- #32FACREADOUT,2PLEASEGIVEUPFACs]_>@@+.---@._+>][
#x%+>+=ttt_Z_*.9 999 99 9999 9                          _         _               _
#D>xU/-<+++L_9  
#R+.----._>]| 9 9999\[\[yYyY
#`<`(+?+?0l0v01k1kMoOMoOMoOMoOMOOx0l0ix0jor0h0h1d111 0eU0y0yx0moO1d0y0e0e00m1d0i0fx0g0n0n11yxMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOotMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i000x1k1x0vx0v0l111111^_0   )000011100\\
[ "`e```.1'.0'.6''i]56pq\{}26q[puts 59][exit]" ,'_\['];#/s\\/;print"24"; exit}}__DATA__/
###x<$+@+-@@@@=>+<@@@=>+<?#d>;?\:-._++._++++._#/<?\>3-++._6+---2._#</++++++++++++++++++++++++++++++++++++++++++++++++._++._++++++.>!\
'(wWWWwWWWWwvwWWwWWWwvwWWWwWWWW\WWWWwWWWWwWWWWW/WW\wWWWWWWWWwwwwvwWW/WwWWWWwvwWWwWWWwvwWWwWWWwvwWWwWWWwx                  (([5]{})))\';';print(( eval("1\x2f 2")and(9)or 13<< (65 )>>65or 68)-(0and eval("\"ppp\".bytes.class==Array and(4)or(95==\"ar_\"[2]and 5-96 or-93)"))^1<<(65)>>62) or"'x"or' {}{}{}{}{}{}{}({}<(((((()()())){}{})  ){}{})>)(({})5){}x{( <(<()>)({})({}<{}>({}){})>){({}[()])}}({}){}({;}()<()()()>)wWW ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho ho dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO dO MU s '#}#(prin 45)(bye)46(8+9+9+9+9+=!)((("3'3)))"'a'[[@*3*74[?]* *]* * *(<\>]xxxxxxxxxxxxxxxxxxxxxxxx)'#\\
__DATA__=1#"'x"  
#.;R"12"' pp
###;{a=1}={a:null};if a then console.log 39 else console.log 180
#  \\
""""#  \
' ( <><        (         x)>  ){ ({}[( )] )}{\';     a=$(printf \\x00) ;b=${#a};#\\
" }"';           ((   ( (';case "{"$ar[1]"}"${b} in *1)echo 54;;*4)echo $((19629227668178112600/ 118248359446856100));;    *1*)echo 50;;*)echo 58;;esac;exit;#( (((') )))#\
=begin  
#p            +555!/2+55x%6E2x !|******[*[?]828+*+]@[*99[?]*]*****|!
;set print "-";print 89;exit#ss          <>
[mxf]-main=-[165]- ###jxf*#p 173#*s       e$P+++++*D*+++1++1E!s
#  
p now 70 dollar off!
p has been selling out worldwide!
seeeemPaeueewuuweeeeeeeeeeCisajjappppppxf⠆⠄⡒⡆⡘😆😨😒😨💬95💬👥➡😻😹😸🙀🙀😹😼😿🙀🙀😼😼😸🙀🙀🙀🙀
👋🔢🌚🌝🌝🌚🌚🌚🌚🌚▲▲▲²²²²▲¡▼¡▲▲¡→  
밠밠따빠빠맣박다맣받다맣희맣희うんたんたんたんたんうんうんうんうんうんたんうんうんうんたんうんたんたんうんたんたんうんたんたんうんたんたんうんたんたんたんたんたんうんうんうんうんたんたんうんたんたんたんうんうんうんたんうんうんたんうんうんたんうんうんたんうんたんうんうんうんたんたんうんたんたんうんたんたんうんたんたんうんたんたんたんうんうん  
😊♈💖  
😇♈♈  
😊♉♈  
😇♈♈  
😇♈♉  
😇♈💜  
😊♉♈  
😊📢♈  
😈♈💜  
😊📢♈  
😇♉💞  
😊📢♉⠀⢃⠛⠋  
#-49,A,-1                              #
#-5,A,-1                               #
#6,A,-1                                #
1     ! !
2   !    !
1      !!
1  x*
53  ++-------+
1  x*|$0011 \|
51  +|/1000 /|
1  x*|\ 0011\|
34  +|/01 00/|
15  +|\ 0011\|           ?   ?@       _     !
1   *|@ 0110/|          ?@    ?
1    |      +|            +   *
1   !+-------+---       ?  !  ?
1    !            <``=>  ? @ ?
<  <    <<   <  <
< B=  =====  =>8 =
, 8= > B    = =
=  ==  =    = >   8  =
D B+  +=   D  x   xxx x
` `  + =   >  8  = >
 x ~   B  =   =  = = > ~
 B +   =  D+  ~ 8  = >x
x   x  x x      x  xx  x
x   x    x+   xx   x + +  +    +    +
x    x xx     xx                +++   +
x+  +x +x     x + +      +  +
 8=+,  _         +    +   +         +
   +     +                +  +    +
 +             +  +  +      + + +    +
   +    +      +           +
   +    +      +          +    +      +
   +           +            +
   +      +  + +            +
   +       +   +            +
          +    +            +
# +   +                  +
#+     +     ++  +     +     +
#  +      +     +
+#
  *   +
  *+*

#  *************************************************+
# +  +
#          +                                       +
   +    + *
         *****+
# +       +
#   +        +
  * *
   +*****
#        +
   ( printout t 164         )
(exit  )  
#cepp  
MsgBox(0,"",169                     )
#cs  
Yo::=~147
::=  
You can see an x here.<<<<
  
>{-<<<<<  
> 176
>> Output 1
>SET x TO 120. [0]{472454523665721469465830106052219449897}
>X x. PPQ-}
>x--/2  
> =157;y=146--/2 
>main=print y{-sss 
  
\begin{code}  
{-x   ␉␉␉␉ 
␉
 ␉  



-}
open import IO;main = run         (putStr"159"   )
\end{code}
ppppppppppppp
Take Northern Line to Tooting Bec
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Embankment
Take Bakerloo Line to Embankment
7 UP
Take Northern Line to Mornington Crescent
7 RIGHT
7 RIGHT
7 TEACH
6 BOND
6 BOND
6 BOND
5 RIGHT
5 LEFT
5 RIGHT
7 BOND
7 TEACH
5 TEACH
6 YELL
5 TEACH
6 YELL
6 YELL
set ! 57,,...,,.,,..,,,,,,..,,,.$^
set ! 51.                         #"6027"1,_ye do{--}gibe16"124"#8+*sizeString tnd xfmain=96los*81''cayY
More 91 of this red down one blue up red down one blue up red up one red right two blue up sss_ baa baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeeeeet bleeeeeeeeeeeeet bleeeeeeeeeet baaaa bleet bleeeeeeeeeet bleeet bleeeeeeeeeet
How much is it
wwWWWwWWWWWwWWWWWWWwWWWWWWWWppppp
When this program starts:
There is a scribe called x
x is to write 179

*/
#if 0
.int 2298589328,898451655,12,178790,1018168591,84934449,12597
#endif//*
#1""//*
#include<stdio.h>
#define  x(d) #d
#define u8 "38\0 "//"
char*x="24 10 31 1"
"a c #FFC0FF""B c #0000C0""d c #58007B""e c #0C8302"
"h c #E60001""i c #CAFFFF""j c #280000""k c #CA0000""l c #CA007F""n c #330001 ""q c #E60000"
"o c #FF8000""t c #FF00BC""u c #008080"
"A c #0040C0""E c #808000""F c #00C040""G c #008000 ""R c #800000"
"H c #0000AA""I c #00AA00""J c #55FFFF""K c #AAAAAA"
"r c red""g c green""b c blue""c c cyan""m c magenta""y c #FFFF00""x c black""_ c #FFFFFF"
"HHHahtdegggggggyrggggggc"
"IHHaixuEFbGGbggbryAEGRgc"
"JJHajyurbgbgggggggb____o"
"IJHakmyyyyyyyyyyyyyyyyye"
"I__almyyyyyyyyyyyyyyyyye"
"K__anmyyyyyyyyyyyyyy_y_e"
"HH_aqggyyyyyyyyg____m_Je"
"JH_axxxxxxxxxxxxxxxxxxxx"
"K__aaaam___bbbbbBm_bbBab"
"K__________bbbbb___bbxbb";//"
int f(char*a,char*b    ){  puts(a?"124":sizeof(0,u8)-5?u8"67":*u8""?"37": x( 0'0  "'\"")[9]?"75":'??-'&1? "79":"77"  );}main(){f(x,x=0);}//<*/
#1""/*/
 
>import Text.Heredoc--WWWWWWWWWWWWWW<<W
>instance Num B where fromInteger _=B 170;negate _=B$x#x
>data B=B{u::Integer};g=[here|here<-"W>W"] --WWWWWWWWWW570rt Unc27<<[w|]
>x=1;y#a=128;x#a=174
>main=print$last$172:[u$[-1]!!0|g<"Z>"] --}
 
 console.log 178;
 
#1""/*/
#if 0
#endif//* --... ...--
/*/
p=sizeof(" (\");   print'(''72'')';end!" );main(){    puts('??-'&1?"101":"92");return 0;}
#if 0
#endif//* rk:start | print: "69" rk:end                       @,-1,:*b5<>␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␌␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␌␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋␋
print 61
#}
disp 49
#{
}{}<>        K yya+-        &  g+$
$'main'3x             A=AgRA;       AC
#-3o4o#$$$
#<T>"3"O._</+++++++>/+++<-\>+++.---.\_<!+++++++++++++++++++++++++++++++++++++++++++++++++._++.-.>@
#<<<#>>>  /
reg end="";print(85);reg s#++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-.
=end
;"""#"#xxxxclou"78"<\++++>/<~#class P{function:Main (a:String[]  )~Nil{83->Print(); }}
#endcOmment
#nocOmment   outtext("155" )
#ce pS9^7^8^MUOUOF @0:8:8      \    @,,1'1'<> @125iRE
#p|o51~nJ;#:p'34'3             \=# print(size([[1] [3]][1,:]  )[1]==2?158+4:17 )#>say 27#>>>say 170-3#]#print(47)#]#echo 21#>/#print(171)#s-#print 175#s
#8M`|   <esc>dggi2<esc>//      $}<}}<}>}[<< }<<<<<}<<}<<<<}<<<}}}<}}<}}<}     }<}}<}}<}}}<}}<<<<<<<<<<<}}}<}}<}}<}}<}}<}}<}}}<<<<<<<<<<}+++++++++++++++++++++++++++++++++++++++++++++++++._++.._#]~-<~-<~-<<<~-<COprint("65")#`=>ass^_^_#
#9 "25"   +/pppppppx     eeee*n*n*n*es*s*s*^ee*n*n*n*e*sss*e*n*n*n*ee*s<* 5>1  e*///\)Q222999686#

Try it online!

This is another addition from A Brief History of 2D Programming Languages.
I used this interpreter.

There are two ways to print in Ropy - to use # instruction or implicitly print top of the stack on exit. I use second method as it is standard for Ropy - see examples. # does nothing if stack is empty, so # at (0,0) is harmless.

Main code is on line 3: 18&1&.
181&&18&1& for Pip.

Normally Ropy IP wants to turn left. So when on the first line it moves straight. When top of the stack is 0 IP wants to turn right, which causes problems. To remove first 0 from IP path I changed 0| to 1& in Japt code on line 2. Second 0 is on line 1, it was fixed by adding spaces to line 2 under it so that IP cannot turn right. So there must be no nonspace chars on line 2 near pink code. Important spaces are shown in gray.

enter image description here

Labyrinth broke, and the easiest way for me to fix it was to remove * from line 4. So now Brat comment starts on line 14. Second * is for Agony. As in Zephyr answer, two new lines added for Brat forced to move / on line 1 to keep Kleins in the same place relative to surrounding code, other 2D langs were updated accordingly.

\$\endgroup\$
2
  • 4
    \$\begingroup\$ What is this madness!? A 10KB, 181-lang polyglot!? \$\endgroup\$
    – AAM111
    Commented Feb 25, 2018 at 3:52
  • 1
    \$\begingroup\$ VIP score: 0.001686 \$\endgroup\$
    – Luke
    Commented Mar 4, 2018 at 16:34
1
2
3 4 5
16

Your Answer

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