Skip to main content
2 of 4
Fixed VIP score and link
Luke
  • 4.8k
  • 16
  • 23

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 stack, 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!

Luke
  • 4.8k
  • 16
  • 23