24
\$\begingroup\$

In this question each answer will get a "toolbox" that can be used to construct a program/function. The toolbox will consist of two things:

  • a list of programming languages

  • a list of valid characters

You must write a valid program/function in one of the languages provided using only the characters in the toolbox. Your program/function should output the number of answers already present on this question.

Once you have written and posted an answer the language and characters you have used will be removed from the toolbox and 1 new language and 12 new characters will be randomly added to be used as the toolbox for the next answer.

Rules

  • Each answer will:

    • Output the number of valid answers coming before it
    • Contain a subset of the characters provided in the toolbox for that answer. (repeats are allowed)
    • Be in one of the languages from the provided toolbox
  • The next toolbox will determined by this python program. To generate the next toolbox put in the remaining languages and characters along with the post id of the last answer.

  • The language list here is all the languages available on try it online at the time of this post. The characters have char codes 0-127.

  • You may write either a full program or a function as your answer. Since REPLs are different languages they will not be allowed. (use the TIO version of every language)

  • If a language uses a special encoding the characters should be interpreted as bytes (decoded from ASCII and padded with a zero).

  • The starting toolbox will be randomized from this questions post id (126063), there will be 7 languages to start and I will add the characters echoprint0 and ascii 0-31 for free to get people started.

  • You may not answer twice in a row

Scoring

Each person will have a score equal to the number valid answers they have provided. There will not necessarily be an end and I will not be accepting any answers.

Sporting

This is a competition, but I encourage you to put fun above winning while still staying competitive (if I could make the winning criteria "fun had" I would). Some things that are not fun:

  • Intentionally using characters you don't need to stunt future answers.
  • Attempting to game the post id system to make future tool boxes harder to use.
  • Attempting to game the post id system to make future tool boxes easier to use.

I can't prevent any one from doing these things, but I will be downvoting any answers I suspect are doing this.

On a more positive note, here are some things that are good sporting and encouraged:

  • Coordinating with other users in chat.
  • Saving characters for harder or more restrictive languages
\$\endgroup\$
15
  • \$\begingroup\$ Can we output numbers in bases other in 10? \$\endgroup\$
    – sporkl
    Jun 13, 2017 at 14:09
  • \$\begingroup\$ @ComradeSparklePony If that is the standard way of outputting in a language. \$\endgroup\$
    – Wheat Wizard
    Jun 13, 2017 at 14:10
  • 3
    \$\begingroup\$ Well...an interesting setup that got nipped in the bud early due to too many missing characters for languages that are defined by a very small set of characters. Logicode got hosed by the lack of a 1 and ! in its toolbox. I managed to produce the string "0110" using ?,0 and + although I couldn't quite figure out what the ? actually did (and it was not in the language specification). But + was missing from the toolbox as well, along with = which would have allowed for variable assignment. Aaanndd...no o for output. \$\endgroup\$ Jun 13, 2017 at 17:34
  • 1
    \$\begingroup\$ @Draco18s I found an SML answer, so maybe now there are enough chars available for a logicode answer. \$\endgroup\$
    – Laikoni
    Jun 14, 2017 at 10:46
  • 1
    \$\begingroup\$ Adding 12 new characters each time may have made this too easy. \$\endgroup\$
    – mbomb007
    Jun 16, 2017 at 15:53

56 Answers 56

7
\$\begingroup\$

2. Cubix, (no@

Third time's the charm

(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((no@((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((

Try it online!

Next toolbox

\$\endgroup\$
5
\$\begingroup\$

1. 3var (1 byte)

Toolbox

['elf', 'cubix', 'sml-mlton', 'forte', 'logicode', 'python1', '3var']
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e.0@BGN`ceghilnoprtvwz}'

Code

p

Try it online!

Next toolbox

\$\endgroup\$
4
\$\begingroup\$

3. Pari/GP, 3 bytes

`
2

Exploits a syntax error.

Try it online!

Next toolbox

\$\endgroup\$
4
\$\begingroup\$

5. J, 3 Bytes

5|9

Performs 5 mod 9, outputting 4

Next toolbox!

\$\endgroup\$
6
  • \$\begingroup\$ I pasted in the wrong toolbox link, it should be correct now \$\endgroup\$
    – nkizz
    Jun 13, 2017 at 1:20
  • 1
    \$\begingroup\$ you still need the answer to output 4 \$\endgroup\$ Jun 13, 2017 at 1:27
  • \$\begingroup\$ In the question: Each answer will: Output the number of valid answers coming before it. There are four valid answers before this one, so your program must output 4. If you cannot make that happen, please delete your answer. \$\endgroup\$ Jun 13, 2017 at 1:33
  • 1
    \$\begingroup\$ Can you post a TIO link? Also I'm pretty sure that's 9 mod 5, not 5 mod 9 \$\endgroup\$
    – PunPun1000
    Jun 13, 2017 at 12:24
  • 1
    \$\begingroup\$ That's 9 mod 5. \$\endgroup\$
    – isaacg
    Jun 16, 2017 at 10:15
4
\$\begingroup\$

15. Half-Broken Car in Heavy Traffic

# 
^
^
^
^
^
^
^
^
^
^
^
^   >>v
  < ^ 
^ >   v
  ov ^
^< <  <

Outputs is in cell -2.

Try it online!

Next Toolbox

\$\endgroup\$
5
  • \$\begingroup\$ For number 16, I don't think it is possible in TRANSCRIPT or Emojicode. Transcript requires a > before lines that do stuff like print, and Emojicode needs emojis. \$\endgroup\$
    – sporkl
    Jun 14, 2017 at 20:32
  • \$\begingroup\$ For 16 in scala, how much of this is needed? object A{def main(a:Array[String]){print(Integer.parseInt("F",16))}} TIO. Most of that is the main, so can that be left out? \$\endgroup\$ Jun 14, 2017 at 20:58
  • \$\begingroup\$ @andrewarchi You can write an function that returns 16. That might save you. I don't know scala so thats about as helpful as I can be. However we currently have all of the characters so I wouldn't worry about using them. \$\endgroup\$
    – Wheat Wizard
    Jun 14, 2017 at 21:09
  • \$\begingroup\$ @WheatWizard The two changes that I see are hbcht which I used and emojicode which seems to be removed from the generator program entirely. I assume the emojicode change was intentional. I didn't do that. \$\endgroup\$
    – Riley
    Jun 14, 2017 at 22:34
  • \$\begingroup\$ @Riley Ah I see all is good then. \$\endgroup\$
    – Wheat Wizard
    Jun 14, 2017 at 22:35
3
\$\begingroup\$

6. Forte

Uses \n 187-DENPUT

1 PUT 71-18
7 END

Try it online!

Next toolbox

\$\endgroup\$
6
  • \$\begingroup\$ no ( -> scheme-chez , scala. no 1 nor ! -> logicode \$\endgroup\$
    – marcosm
    Jun 13, 2017 at 13:46
  • \$\begingroup\$ @marcosm Good point, I hope my toolbox didn't stop the chain ;_; \$\endgroup\$ Jun 13, 2017 at 15:44
  • \$\begingroup\$ logicode actually has a problem with the fact that the characters to write out are missing. I managed to get out ?+?+?+0 to produce the binary expression of 6....which appears to be valid if "that is the standard way of outputting in a language" is allowed here, which for logicode would be mostly true. There is a convert-to-ascii, but without an = you can't assign ?+?+?+0-like expressions to a variable to convert, nor can you wrap in parenthesis, due to a lack of (. ?+?+?+0 by itself is valid code...but produces no output. + is also missing, so even that won't work... \$\endgroup\$ Jun 13, 2017 at 17:01
  • \$\begingroup\$ no E -> Forte (program would loop forever without an END keyword) as no P,R,N, and T for the PRINT command. I cannot find a language definition for elf, assembly-as, or mlton (or at least, not enough in order to determine how to produce output). no (,o,s,; -> Javascript (unable to call console.log(...)), no r for alert (if tio allowed it). \$\endgroup\$ Jun 13, 2017 at 17:23
  • 1
    \$\begingroup\$ @Draco18s You don't need brackets for JavaScript since backtick and 6 are both legal, so you could do console.log`6` , the problem would be getting access to console.log since s isn't available \$\endgroup\$ Jun 13, 2017 at 17:33
3
\$\begingroup\$

7. Standard ML (MLton), 7 bytes

fun$n=6

Try it online! This declares a function $ which takes any argument and returns 6, eg. by calling with $().

New toolbox. Powershell is the newly added language.

\$\endgroup\$
1
  • \$\begingroup\$ Looking at the new toolbox...No (, no 1, no !, no E, no P, no s. The same characters that were precluding the other languages are still missing. :\ \$\endgroup\$ Jun 14, 2017 at 13:33
3
\$\begingroup\$

23. DStack, 5 bytes

222cK

Explanation

DStack is read in pairs and moves the cursor one char at a time, so the instructions become 22, 22, 22, and cK.

22  Multiplies register by 10 (initially 0), adds 2
22  Multiplies register by 10, adds 2
2c  Does nothing
cK  Displays number of the register

Try it online!

Next Toolbox

\$\endgroup\$
3
\$\begingroup\$

27. Assembly (x64, Linux, as)

.text
  .global _start
_start:
movl $len,%edx
movl $msg,%ecx
movl $1,%ebx
movl $4,%eax
int $0x80
movl $0,%ebx
movl $1,%eax
int $0x80
.data
msg:
.byte 0b110010,0b110110
len = . - msg

Try it online!

Explanation

I don't really know Assembly as, and information online seems hard to find ,so this is modified from the Hello World test on TIO.

The main issue here is that we lack the 2 byte, (turns out we did, but hey looks like I saved a 2 for the next answer) this makes it relatively hard to print 26. We can't use raw ascii or even Hexadecimal (0x32) so I ended up using binary.

msg:
.byte 0b110010,0b110110

Tells it to output the two bytes 2 and 6.

Next toolbox

\$\endgroup\$
3
  • \$\begingroup\$ That looks so ugly for something as trivial as printing 26 \$\endgroup\$ Jun 15, 2017 at 17:31
  • 1
    \$\begingroup\$ I get a 2 when running the toolbox from either 25 or 26. You must have just forgotten to run it \$\endgroup\$ Jun 15, 2017 at 17:39
  • \$\begingroup\$ This works xD \$\endgroup\$
    – Okx
    Jun 17, 2017 at 9:06
3
\$\begingroup\$

35. ELF 32-bit LSB executable (Linux), 48 bytes

0000000: 7f 45 4c 46 01 00 00 00 00 00 00 00 00 90 43 0d  .ELF..........C.
0000010: 02 00 03 00 19 90 43 0d 19 90 43 0d 04 00 00 00  ......C...C.....
0000020: b9 2e 90 43 0d b2 0d cd 80 cc 20 00 01 00 33 34  ...C...... ...34

I've done it! I have conquered the elusive ELF. ELF has been the first language in the list ever since the first toolbox. Now we can move on.

I've never used or even heard of ELF before, so this one was an adventure to figure out. I eventually copied much of Dennis' 32 bit Hello, World! program (64 bit version here). I modified it to print 33 and was able to remove a line of bytes.

Chars used: \x00\x01\x02\x03\x04\r\x19 .34CEFL\x7f\x80\x90\xb2\xb9\xcc\xcd

Try it online!

Next Toolbox

\$\endgroup\$
1
  • 2
    \$\begingroup\$ We have done 35/243 languages! Only 85.596707% more languages left! \$\endgroup\$ Jun 16, 2017 at 5:09
2
\$\begingroup\$

9. JavaScript (Babel Node), 14 bytes

console.log`8`

Try it online!

Miraculously all the characters needed were available.

Next toolbox New language: pylons (Should be easy ;).

\$\endgroup\$
3
  • \$\begingroup\$ I am not sure how to get the link for the next toolbox though. \$\endgroup\$ Jun 14, 2017 at 18:15
  • 1
    \$\begingroup\$ To get the next toolbox you can copy the last toolbox from the output section into the input section, and replace the number with your post id. (hit share it should be the number in the url starting with 126...) I've done it for you here. \$\endgroup\$
    – Wheat Wizard
    Jun 14, 2017 at 18:18
  • \$\begingroup\$ @WheatWizard Cool. I thought so, but in trying to work it out I got interrupted by Real Life and it was easier to flail out a comment and wait for an edit. Thanks :) \$\endgroup\$ Jun 14, 2017 at 18:25
2
\$\begingroup\$

18. C# (.NET Core), 33 bytes

()=>System.Console.WriteLine(17);

Try it online!

Next Toolbox

\$\endgroup\$
2
\$\begingroup\$

20. TRANSCRIPT, 45 bytes

You can see a Q here.
>SET Q TO 19
>X Q
>QUIT

Explanation:

TRANSCRIPT is designed to resemble interactive fiction scripts. So rather than using variables, objects and NPCs are used. Commands and dialog (essentially comments) are mixed together.

You can see a Q here.    Creates an object named Q
>SET Q TO 19             Assign Q to 19
>X Q                     Display Q
>QUIT                    End the program

Chars used: .19>EIOQSTUXYZacehnorsu

Try it online!

Next Toolbox

\$\endgroup\$
0
2
\$\begingroup\$

29. Pushy, TL#

TTTTTTTTTTTTTTTTTTTTTTTTTTTTL#

This pushes 10 to the stack 28 times, then gets the length of the stack and prints it.

Try it online!

Next toolbox

\$\endgroup\$
1
  • \$\begingroup\$ Great language name! \$\endgroup\$ Jun 15, 2017 at 20:11
2
\$\begingroup\$

34. Java (OpenJDK 9), 63 bytes

interface a{static void main(String[]a){System.out.print(33);}}

I figured this was getting a bit too easy, with all the characters available and all...

Try it online!

Next toolbox

\$\endgroup\$
5
  • \$\begingroup\$ That's handy. I didn't know that when using an interface main doesn't need public and print doesn't need the full path! I was going to do class S{public static void main(String[]a){java.lang.System.out.print(33);}}, a whole 13 bytes more. Though if you named the interface S, then you would save a char. \$\endgroup\$ Jun 16, 2017 at 4:49
  • \$\begingroup\$ Whoops, a was supposed to be lowercase \$\endgroup\$ Jun 16, 2017 at 4:54
  • 2
    \$\begingroup\$ Yeah - I feel like the toolbox generator is adding too many chars each time. \$\endgroup\$ Jun 16, 2017 at 5:05
  • \$\begingroup\$ @WheatWizard would you be able to modify the toolbox script to add back fewer chars? Adding 12 each time seems like too much because in most cases, we use less than 12 chars (except for Java that used 28). \$\endgroup\$ Jun 16, 2017 at 5:06
  • \$\begingroup\$ @andrewarchi I think I will leave the character count on this question, I plan on doing a revamped version of this question with a lower character count and some more features to keep it interesting. \$\endgroup\$
    – Wheat Wizard
    Jun 16, 2017 at 15:31
2
\$\begingroup\$

45. Templates Considered Harmful, Ad<T,>

Add<Add<Add<Add<Add<Add<T,T>,Add<T,T>>,Add<Add<T,T>,Add<T,T>>>,T>,Add<T,T>>,Add<Add<T,T>,Add<Add<Add<Add<T,T>,Add<Add<Add<Add<Add<Add<Add<T,T>,Add<T,T>>,Add<Add<T,T>,Add<T,T>>>,T>,Add<T,T>>,Add<Add<T,T>,Add<Add<Add<Add<T,T>,Add<T,T>>,Add<Add<T,T>,Add<T,T>>>,T>>>,T>>,Add<Add<T,T>,Add<T,T>>>,Add<T,T>>>>

Try it online!

Next Toolbox

\$\endgroup\$
1
\$\begingroup\$

4. Python 1 print+3

print+3

Try it online!

Next toolbox

\$\endgroup\$
1
\$\begingroup\$

8. PowerShell Core, 1 byte

7

Try it online!

I had no idea what powershell is, but it turns out that 7 outputs 7 in TIO.

Next toolbox

\$\endgroup\$
1
\$\begingroup\$

10. Prelude, 3+!

We finally got an !!

3333333333333333333++++++++++++++++++!

Try it online!

Next toolbox

Explanation

9 is 57 in ASCII, which is 3 times 19. So in order to get 9 we add 19 3s and use ! to output.

\$\endgroup\$
2
  • \$\begingroup\$ Two number 9s?? \$\endgroup\$
    – user70700
    Jun 14, 2017 at 18:26
  • \$\begingroup\$ @OrphanBot Sorry this is number 10, still works though :) \$\endgroup\$
    – Wheat Wizard
    Jun 14, 2017 at 18:26
1
\$\begingroup\$

11. Convex, 1 byte

A

Try it online!

Next toolbox

\$\endgroup\$
1
\$\begingroup\$

12. Logicode, 6 bytes

out 11

Try it online!

trivial, right language for 11

Next toolbox

\$\endgroup\$
4
  • \$\begingroup\$ Was fiddling with this to see if I could get it to print 11 as ascii characters rather than binary-11, couldn't get it to do them on the same line. \$\endgroup\$ Jun 14, 2017 at 18:36
  • \$\begingroup\$ I am not sure your toolbox is correct. It is taking a post number of 26407 and your answer is actually 126407 \$\endgroup\$ Jun 14, 2017 at 18:55
  • \$\begingroup\$ does it looks correct now? \$\endgroup\$
    – marcosm
    Jun 14, 2017 at 18:58
  • \$\begingroup\$ Yep. I hadn't noticed the discrepancy until after I did #13 and was getting its toolbox and I was like "hold on a moment..." And it totally invalidated the entry. \$\endgroup\$ Jun 14, 2017 at 19:30
1
\$\begingroup\$

16. Scala, 13 bytes

()=>print(15)

Try it online!

Next Toolbox

\$\endgroup\$
1
\$\begingroup\$

17. 2sable (Prints 16)

4n

Try it online!

4  # Push 4
 n # Square it

Next Toolbox, new language: golfscript

\$\endgroup\$
1
\$\begingroup\$

19. pbrain, 58 bytes

+++++++++++++++++++++++++++++++++++++++++++++++++.+++++++.

Prints ASCII values 49 and 56 (18).

Try it online!

Next toolbox

\$\endgroup\$
1
\$\begingroup\$

22. MarioLANG, 44 bytes

+++++++++++++++++++++:
=====================

Boring but shortest.

Try it online!

Next Toolbox

\$\endgroup\$
1
  • \$\begingroup\$ Hah! You beat me by 13 seconds. I'll change mine to 23 \$\endgroup\$ Jun 15, 2017 at 16:04
1
\$\begingroup\$

24. Chez Scheme, 12 bytes

(display 23)

Try it online! Next toolbox. Arcyóu is the new language.

\$\endgroup\$
1
  • \$\begingroup\$ +1 I was going to do (printf "23"), but yours is shorter \$\endgroup\$ Jun 15, 2017 at 17:24
1
\$\begingroup\$

28. Haskell, 6 bytes

f x=27

Try it online! Declares a function f which takes any argument and returns 27.

Next toolbox:

['elf', 'logicode', 'visual-basic-net-mono', 'python2-pypy', 'silos', 'pushy', 'agony']
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f!"#$%&\'()*+,-./1234569:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^`cdghijkopqrtuvwxz{|}~\x7f'
\$\endgroup\$
1
\$\begingroup\$

30. Visual Basic .NET (Mono), 9 bytes

MSGBOX 29

Pops up a system dialog box containing 29. Very similar to alert in javascript. It is case insensitive, but is usually written as MsgBox.

This can't be tested on TIO because MsgBox is a system window and that can't be seen online. The easiest way to test it is by pasting the code into a .vbs text file and running it on Windows. A .vbs file uses VBScript, a scripting version of VB that is very similar (MsgBox is the same between the two).

It's fun to use MsgBox again as that was the very first thing I ever programmed. In fifth grade, I made a series of MsgBox scripts to mess with friends.

Next Toolbox

\$\endgroup\$
1
\$\begingroup\$

31. Python 2 (PyPy), print-31

print--31-1

Try it online!

--31 is the same thing as 31, then -1 subtracts 1, making it 30.

Next toolbox

\$\endgroup\$
0
1
\$\begingroup\$

33. Minkolang, 9 bytes

"332"(O).

Try it online!

Next Toolbox

Never heard of this one before, I have no idea how it works. It just did weird stuff and I went "ok fine" and got it to print what I wanted. :D

\$\endgroup\$

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