Skip to main content
1 of 5
user avatar
user avatar

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.

user62131