Skip to main content
3 of 3
consistency in header leveles
user avatar
user avatar

53. Shove, 1158 bytes

#16  "(}23!@)(" 3//*v\D@;'[af2.qc]'#)"14";n4
#/*` PkPPZ (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]>+.-- -. >][
#x%+>+=+~tt .
#D>xU/-<+++L
#R+.----\).>]|
#[#[(}2}20l0v0x1k1k\4O6O@MoOMoOMoOMoOMOO0l0ix0jor0h0h1d111x0eU0yx0y0moO1d0y0e0e00m1d0i0fx0g0n0n11MoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOo0moo0n0tx0t0moO0f0t0gOOM0g0f0h0j0j0i0001k10vx0v0l111111^_)0046(8+9+9+9+9+=!)
###|
'\';echo 50;exit;';print((eval("2\x2f5")and(9)or(13))-(0and 4)^1<<(65)>>(62))or"'x"or'({({1})({1}[(0)])}{1}\{1})'#}#(prin 45)(bye)|/=1/24=x<$+@+-@@@@=>+<@@@=>+<?#d>+.--./
__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*///89^_^_Z222999"26

Try them 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.

Want to learn more? Try the polygot chat!

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

Rundown

This program prints 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 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.

  • Modular SNUSP can be tested to output 31 here.

  • Incident was verified to test 33 by running the official interpreter on my own machine.

  • 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.

  • Shove was tested to output 53 using Ørjan's interpreter (which is a slight modification of my own that handles I/O in a much better way for this challenge than mine did); it was formerly available at this link, but the link is now dead. Luckily, the Wayback Machine had saved a copy. Turns out that that's no longer needed; a) Ørjan's website is back up now; b) TIO now supports Shove, so the program is now part of the main testbench.

Explanation

Shove

At this point, the challenge is mostly just about finding languages that predate the challenge to add, and then finding working interpreters for those languages that also predate the challenge glares at PPCG rules. (Anyone happen to have a pre-existing Sansism interpreter handy?) So I decided to look down the list of 2D languages on Esolang to see if any of them gave me inspiration, and stumbled across one of my own.

Shove is basically a 2D language inspired by Underload. However, rather than using an eval command ^ that works on the stack directly, stack manipulation instead works by dropping the contents of the stack directly into the program, shoving aside things that were already there, and then letting the IP run into it. In this polyglot, we're ignoring all that, and just outputting a string literal without doing any sort of calculation.

The really nice thing about using Shove in this polyglot is that it naturally splits itself off from the other languages; running polyglot #52 unmodified in a Shove interpreter causes the IP to fall off the second line of the program in stringmode, complaining about an unterminated string literal ("…" and '…' are both strings, and apart from that, the only relevant characters to Shove are the v in the first line and the > immediately below it in the second; I'm pretty glad that the interpreter ignores what it can't understand). Well, that's easy enough to fix, and dropping an apostrophe in just before the final q lets us create a capsule that only Shove parses (besides the languages that parse everything, obviously). '53'S is our Shove program to print 53. We then use the ^ command to change execution direction to upwards, causing the IP to fall off the playfield and exit the program. Simple enough, right?

Alphuck

Shove's print command S closes blocks in Alphuck. That was the easiest non-empty fix here; just drop in a P to balance it just before the Shove capsule, and everything just works.

Cubix and INTERCAL

Normally, you can just find a point in the program which Cubix control flow hits naturally, and move the Cubix capsule around into its path; not a lot of Cubix commands have irreversible effects, so you often have a lot of choice. Here, though, the very first command is naturally O, which will output a zero before we can do anything else. What a pain.

The O is inside the INTERCAL code, at a point which is fairly difficult to pad out of the way (it's in the middle of a fairly long keyword), so I decided to rearrange the INTERCAL code instead. In this case, I moved the politeness to a different part of the code. I also changed one copy of DO to FAC because I needed a padding character for Cubix to prevent its capsule breaking up an Incident token that's part of the main program. That let me drop the capsule into the Incident/COW line, which is to be honest probably the easiest place to put it.

Fission

Fission is an absolute minefield here, and even with the help of a Fission debugger I couldn't figure out what was causing extraneous output in the Fission program. In the end, I decided that in the interests of keeping the polyglot going, I'd try to terminate the Fission program as soon as possible. This isn't a challenge, but in Fission, it may as well be; there are way too many Fission landmines (atom bombs?) now in the code for the Fission code to sanely be allowed to run for long.

There are two potential ways to do this; add something like R.__* to a safe place in the polyglot as a sort of fuse that causes the program to end, or just remove the __ that sets the exit code in the existing program. In the end, laziness ran out, and I decided that an intentional exit with exit code 2 was the simplest way to stop having to think about Fission any more; after all, it's within the rules, and we can always fix it later if we really want to.

Incident and Python

Nearly all the changes I made have zero effect on Incident, so I was hoping to get away without any incidents occurring. However, removing one of the three copies of __ while fixing Fission created a token imbalance, fairly obviously. Given that I created Incident and thus ought to know it better than most of the other people here, I looked for a zero-byte way to fix it, and did so in a rather indirect way; Python's division "1\x2f2" can be changed to any other fraction numerically between 0 and 1, such as "2\x2f5", which causes "1 to no longer appear three times in the program. Now, that wasn't a token anyway, but the reason it wasn't a token was because 12 also appeared three times in the code, and the overlap "12 in the Fission code disqualified both tokens. Remove "1, and now there's no overlap, meaning that 12 becomes a token, and rebalances the code.

And that's pretty much it. I hardly added anything, and thus hardly had to change anything; this program's only 8 bytes longer than the last. (Sorry for reducing the VIP headroom so much. Hopefully there's still space for whatever you want to do, and if there isn't, we can always backtrack on the VIP score a bit and make it up later.)

user62131