# MacGyver's Toolbox [duplicate]

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

• 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
• Can we output numbers in bases other in 10? – Comrade SparklePony Jun 13 '17 at 14:09
• @ComradeSparklePony If that is the standard way of outputting in a language. – Wheat Wizard Jun 13 '17 at 14:10
• 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. – Draco18s no longer trusts SE Jun 13 '17 at 17:34
• @Draco18s I found an SML answer, so maybe now there are enough chars available for a logicode answer. – Laikoni Jun 14 '17 at 10:46
• Adding 12 new characters each time may have made this too easy. – mbomb007 Jun 16 '17 at 15:53

# 2. Cubix, (no@

Third time's the charm

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


Try it online!

Next toolbox

# 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@BGNceghilnoprtvwz}'


## Code

p


Try it online!

Next toolbox

# 3. Pari/GP, 3 bytes


2


Exploits a syntax error.

Try it online!

Next toolbox

# 5. J, 3 Bytes

5|9


Performs 5 mod 9, outputting 4

Next toolbox!

• I pasted in the wrong toolbox link, it should be correct now – nkizz Jun 13 '17 at 1:20
• you still need the answer to output 4 – Destructible Lemon Jun 13 '17 at 1:27
• 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. – JungHwan Min Jun 13 '17 at 1:33
• Can you post a TIO link? Also I'm pretty sure that's 9 mod 5, not 5 mod 9 – PunPun1000 Jun 13 '17 at 12:24
• That's 9 mod 5. – isaacg Jun 16 '17 at 10:15

# 6. Forte

Uses \n 187-DENPUT

1 PUT 71-18
7 END


Try it online!

Next toolbox

• no ( -> scheme-chez , scala. no 1 nor ! -> logicode – marcosm Jun 13 '17 at 13:46
• @marcosm Good point, I hope my toolbox didn't stop the chain ;_; – Business Cat Jun 13 '17 at 15:44
• 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... – Draco18s no longer trusts SE Jun 13 '17 at 17:01
• 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). – Draco18s no longer trusts SE Jun 13 '17 at 17:23
• @Draco18s You don't need brackets for JavaScript since backtick and 6 are both legal, so you could do console.log6 , the problem would be getting access to console.log since s isn't available – Business Cat Jun 13 '17 at 17:33

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. • 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. :\ – Draco18s no longer trusts SE Jun 14 '17 at 13:33 # 15. Half-Broken Car in Heavy Traffic # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ >>v < ^ ^ > v ov ^ ^< < <  Outputs is in cell -2. Try it online! Next Toolbox • 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. – Comrade SparklePony Jun 14 '17 at 20:32 • 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? – andrewarchi Jun 14 '17 at 20:58 • @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. – Wheat Wizard Jun 14 '17 at 21:09 • @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. – Riley Jun 14 '17 at 22:34 • @Riley Ah I see all is good then. – Wheat Wizard Jun 14 '17 at 22:35 # 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 # 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 • That looks so ugly for something as trivial as printing 26 – andrewarchi Jun 15 '17 at 17:31 • I get a 2 when running the toolbox from either 25 or 26. You must have just forgotten to run it – andrewarchi Jun 15 '17 at 17:39 • This works xD – Okx Jun 17 '17 at 9:06 # 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 • We have done 35/243 languages! Only 85.596707% more languages left! – andrewarchi Jun 16 '17 at 5:09 # 4. Python 1print+3 print+3  Try it online! Next toolbox # 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 # 9. JavaScript (Babel Node), 14 bytes console.log8  Try it online! Miraculously all the characters needed were available. Next toolbox New language: pylons (Should be easy ;). • I am not sure how to get the link for the next toolbox though. – Draco18s no longer trusts SE Jun 14 '17 at 18:15 • 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. – Wheat Wizard Jun 14 '17 at 18:18 • @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 :) – Draco18s no longer trusts SE Jun 14 '17 at 18:25 # 18. C# (.NET Core), 33 bytes ()=>System.Console.WriteLine(17);  Try it online! Next Toolbox # 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 # 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 • Great language name! – andrewarchi Jun 15 '17 at 20:11 # 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... Next toolbox • 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. – andrewarchi Jun 16 '17 at 4:49 • Whoops, a was supposed to be lowercase – Santiago Benoit Jun 16 '17 at 4:54 • Yeah - I feel like the toolbox generator is adding too many chars each time. – Santiago Benoit Jun 16 '17 at 5:05 • @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). – andrewarchi Jun 16 '17 at 5:06 • @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. – Wheat Wizard Jun 16 '17 at 15:31 # 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 # 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. • Two number 9s?? – user70700 Jun 14 '17 at 18:26 • @OrphanBot Sorry this is number 10, still works though :) – Wheat Wizard Jun 14 '17 at 18:26 # 11. Convex, 1 byte A  Try it online! Next toolbox # 12. Logicode, 6 bytes out 11  Try it online! trivial, right language for 11 Next toolbox • 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. – Draco18s no longer trusts SE Jun 14 '17 at 18:36 • I am not sure your toolbox is correct. It is taking a post number of 26407 and your answer is actually 126407 – Draco18s no longer trusts SE Jun 14 '17 at 18:55 • does it looks correct now? – marcosm Jun 14 '17 at 18:58 • 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. – Draco18s no longer trusts SE Jun 14 '17 at 19:30 # 13. Pylons, 14 bytes 2+2+2+2+2+2+2,  Try it online! Next toolbox (We now have all the characters) • Could you have done 2+2+2... to save characters? – Wheat Wizard Jun 14 '17 at 19:00 • I don't understand the next toolbox, could someone please edit it in? – user70700 Jun 14 '17 at 19:04 • @WheatWizard The current toolbox contains 4 es, is there some bug in the implementation? – Laikoni Jun 14 '17 at 19:13 • @Laikoni Yes there is you can count it as a single e. – Wheat Wizard Jun 14 '17 at 19:13 # 16. Scala, 13 bytes ()=>print(15)  Try it online! Next Toolbox # 17. 2sable (Prints 16) 4n  Try it online! 4 # Push 4 n # Square it  Next Toolbox, new language: golfscript # 19. pbrain, 58 bytes +++++++++++++++++++++++++++++++++++++++++++++++++.+++++++.  Prints ASCII values 49 and 56 (18). Try it online! Next toolbox # 22. MarioLANG, 44 bytes +++++++++++++++++++++: =====================  Boring but shortest. Try it online! Next Toolbox • Hah! You beat me by 13 seconds. I'll change mine to 23 – andrewarchi Jun 15 '17 at 16:04 # 24. Chez Scheme, 12 bytes (display 23)  Try it online! Next toolbox. Arcyóu is the new language. • +1 I was going to do (printf "23"), but yours is shorter – andrewarchi Jun 15 '17 at 17:24 # 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'


# 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

# 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