-6
\$\begingroup\$

In Javascript you can recover the complete language using only the symbols ()[]!+. Here's the basics:

false       =>  ![]
true        =>  !![]
undefined   =>  [][[]]
NaN         =>  +[![]]
0           =>  +[]
1           =>  +!+[]
2           =>  !+[]+!+[]
10          =>  [+!+[]]+[+[]]
Array       =>  []
Number      =>  +[]
String      =>  []+[]
Boolean     =>  ![]
Function    =>  []["filter"]
eval        =>  []["filter"]["constructor"]( CODE )()
window      =>  []["filter"]["constructor"]("return this")()

That's great and all, but where did they get those first 6 characters from? I think it's best we help them out.


Simply write a program or function that outputs (at least) the 6 characters []()!+ in any order you want, as many times as you want, with as many other characters in between as you want. Shortest code wins. Gold star if you use less than 6 unique characters to do so.

\$\endgroup\$
11
  • \$\begingroup\$ outputs (at least) Does that mean cat /dev/urandom is valid since it would eventually print []()!+? \$\endgroup\$ Oct 14, 2016 at 21:01
  • \$\begingroup\$ @TùxCräftîñg well, it's not guaranteed to print all characters, but I'd say the probability is high enough :) \$\endgroup\$ Oct 14, 2016 at 21:01
  • 4
    \$\begingroup\$ This challenge is extremely trivial and boring in nearly every language. \$\endgroup\$
    – DJMcMayhem
    Oct 14, 2016 at 21:02
  • \$\begingroup\$ @Dennis what is unclear? Simply write a program or function that outputs (at least) the 6 characters []()!+. Shortest code wins. \$\endgroup\$ Oct 14, 2016 at 21:03
  • 1
    \$\begingroup\$ The at least part was confusing me, since I didn't think we could actually print whatever we want as long as it includes those characters. Apparently, I was wrong. \$\endgroup\$
    – Dennis
    Oct 14, 2016 at 21:09

14 Answers 14

10
\$\begingroup\$

Bash + iw, 6 4 bytes

iw w

Prints those six characters (and a lot more).

Output

Usage:  iw [options] command
Options:
        --debug         enable netlink debugging
        --version       show version (3.11)
Commands:
        help [command]
                Print usage for all or a specific command, e.g.
                "help wowlan" or "help wowlan enable".
        event [-t] [-r] [-f]
                Monitor events from the kernel.
                -t - print timestamp
                -r - print relative timstamp
                -f - print full frame for auth/assoc etc.
        features 

        commands
                list all known commands and their decimal & hex value
        phy
        list
                List all wireless devices and their capabilities.
        phy <phyname> info
                Show capabilities for the specified wireless device.
        dev
                List all network interfaces for wireless hardware.
        dev <devname> info
                Show information for this interface.
        dev <devname> del
                Remove this virtual interface
        dev <devname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]
        phy <phyname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]
                Add a new virtual interface with the given configuration.
                Valid interface types are: managed, ibss, monitor, mesh, wds.

                The flags are only used for monitor interfaces, valid flags are:
                none:     no special flags
                fcsfail:  show frames with FCS errors
                control:  show control frames
                otherbss: show frames from other BSSes
                cook:     use cooked mode
                active:   use active mode (ACK incoming unicast packets)

                The mesh_id is used only for mesh mode.
        dev <devname> ibss join <SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>] [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] [key d:0:abcde]
                Join the IBSS cell with the given SSID, if it doesn't exist create
                it on the given frequency. When fixed frequency is requested, don't
                join/create a cell on a different frequency. When a fixed BSSID is
                requested use that BSSID and do not adopt another cell's BSSID even
                if it has higher TSF and the same SSID. If an IBSS is created, create
                it with the specified basic-rates, multicast-rate and beacon-interval.
        dev <devname> ibss leave
                Leave the current IBSS cell.
        dev <devname> station dump
                List all stations known, e.g. the AP on managed interfaces
        dev <devname> station set <MAC address> mesh_power_mode <active|light|deep>
                Set link-specific mesh power mode for this station
        dev <devname> station set <MAC address> vlan <ifindex>
                Set an AP VLAN for this station.
        dev <devname> station set <MAC address> plink_action <open|block>
                Set mesh peer link action for this station (peer).
        dev <devname> station del <MAC address>
                Remove the given station entry (use with caution!)
        dev <devname> station get <MAC address>
                Get information for a specific station.
        dev <devname> survey dump
                List all gathered channel survey data
        dev <devname> mesh leave
                Leave a mesh.
        dev <devname> mesh join <mesh ID> [mcast-rate <rate in Mbps>] [beacon-interval <time in TUs>] [dtim-period <value>] [vendor_sync on|off] [<param>=<value>]*
                Join a mesh with the given mesh ID with mcast-rate and mesh parameters.
        dev <devname> mpath dump
                List known mesh paths.
        dev <devname> mpath set <destination MAC address> next_hop <next hop MAC address>
                Set an existing mesh path's next hop.
        dev <devname> mpath new <destination MAC address> next_hop <next hop MAC address>
                Create a new mesh path (instead of relying on automatic discovery).
        dev <devname> mpath del <MAC address>
                Remove the mesh path to the given node.
        dev <devname> mpath get <MAC address>
                Get information on mesh path to the given node.
        dev <devname> scan [-u] [freq <freq>*] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force] [ssid <ssid>*|passive]
                Scan on the given frequencies and probe for the given SSIDs
                (or wildcard if not given) unless passive scanning is requested.
                If -u is specified print unknown data in the scan results.
                Specified (vendor) IEs must be well-formed.
        dev <devname> scan trigger [freq <freq>*] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force] [ssid <ssid>*|passive]
                Trigger a scan on the given frequencies with probing for the given
                SSIDs (or wildcard if not given) unless passive scanning is requested.
        dev <devname> scan dump [-u]
                Dump the current scan results. If -u is specified, print unknown
                data in scan results.
        reg get
                Print out the kernel's current regulatory domain information.
        reg set <ISO/IEC 3166-1 alpha2>
                Notify the kernel about the current regulatory domain.
        dev <devname> auth <SSID> <bssid> <type:open|shared> <freq in MHz> [key 0:abcde d:1:6162636465]
                Authenticate with the given network.

        dev <devname> connect [-w] <SSID> [<freq in MHz>] [<bssid>] [key 0:abcde d:1:6162636465]
                Join the network with the given SSID (and frequency, BSSID).
                With -w, wait for the connect to finish or fail.
        dev <devname> disconnect
                Disconnect from the current network.
        dev <devname> link
                Print information about the current link, if any.
        dev <devname> offchannel <freq> <duration>
                Leave operating channel and go to the given channel for a while.
        dev <devname> cqm rssi <threshold|off> [<hysteresis>]
                Set connection quality monitor RSSI threshold.

        phy <phyname> wowlan show 
                Show WoWLAN status.
        phy <phyname> wowlan disable 
                Disable WoWLAN.
        phy <phyname> wowlan enable [any] [disconnect] [magic-packet] [gtk-rekey-failure] [eap-identity-request] [4way-handshake] [rfkill-release] [tcp <config-file>] [patterns [offset1+]<pattern1> ...]
                Enable WoWLAN with the given triggers.
                Each pattern is given as a bytestring with '-' in places where any byte
                may be present, e.g. 00:11:22:-:44 will match 00:11:22:33:44 and
                00:11:22:33:ff:44 etc.
                Offset and pattern should be separated by '+', e.g. 18+43:34:00:12 will match '43:34:00:12' after 18 bytes of offset in Rx packet.

                The TCP configuration file contains:
                  source=ip[:port]
                  dest=ip:port@mac
                  data=<hex data packet>
                  data.interval=seconds
                  [wake=<hex packet with masked out bytes indicated by '-'>]
                  [data.seq=len,offset[,start]]
                  [data.tok=len,offset,<token stream>]
        phy <phyname> coalesce show 
                Show coalesce status.
        phy <phyname> coalesce disable 
                Disable coalesce.
        phy <phyname> coalesce enable <config-file>
                Enable coalesce with given configuration.
                The configuration file contains coalesce rules:
                  delay=<delay>
                  condition=<condition>
                  patterns=<[offset1+]<pattern1>,<[offset2+]<pattern2>,...>
                  delay=<delay>
                  condition=<condition>
                  patterns=<[offset1+]<pattern1>,<[offset2+]<pattern2>,...>
                  ...
                delay: maximum coalescing delay in msec.
                condition: 1/0 i.e. 'not match'/'match' the patterns
                patterns: each pattern is given as a bytestring with '-' in
                places where any byte may be present, e.g. 00:11:22:-:44 will
                match 00:11:22:33:44 and 00:11:22:33:ff:44 etc. Offset and
                pattern should be separated by '+', e.g. 18+43:34:00:12 will
                match '43:34:00:12' after 18 bytes of offset in Rx packet.

        dev <devname> roc start <freq> <time in ms>

        wdev <idx> p2p stop 

        wdev <idx> p2p start 

        phy <phyname> set antenna <bitmap> | all | <tx bitmap> <rx bitmap>
                Set a bitmap of allowed antennas to use for TX and RX.
                The driver may reject antenna configurations it cannot support.
        dev <devname> set txpower <auto|fixed|limit> [<tx power in mBm>]
                Specify transmit power level and setting type.
        phy <phyname> set txpower <auto|fixed|limit> [<tx power in mBm>]
                Specify transmit power level and setting type.
        phy <phyname> set distance <distance>
                Set appropriate coverage class for given link distance in meters.
                Valid values: 0 - 114750
        phy <phyname> set coverage <coverage class>
                Set coverage class (1 for every 3 usec of air propagation time).
                Valid values: 0 - 255.
        phy <phyname> set netns <pid>
                Put this wireless device into a different network namespace
        phy <phyname> set rts <rts threshold|off>
                Set rts threshold.
        phy <phyname> set frag <fragmentation threshold|off>
                Set fragmentation threshold.
        dev <devname> set channel <channel> [HT20|HT40+|HT40-]
        phy <phyname> set channel <channel> [HT20|HT40+|HT40-]
        dev <devname> set freq <freq> [HT20|HT40+|HT40-]
        dev <devname> set freq <control freq> [20|40|80|80+80|160] [<center freq 1>] [<center freq 2>]
        phy <phyname> set freq <freq> [HT20|HT40+|HT40-]
                Set frequency/channel the hardware is using, including HT
                configuration.
        phy <phyname> set name <new name>
                Rename this wireless device.
        dev <devname> set mcast_rate <rate in Mbps>
                Set the multicast bitrate.
        dev <devname> set peer <MAC address>
                Set interface WDS peer.
        dev <devname> set noack_map <map>
                Set the NoAck map for the TIDs. (0x0009 = BE, 0x0006 = BK, 0x0030 = VI, 0x00C0 = VO)
        dev <devname> set 4addr <on|off>
                Set interface 4addr (WDS) mode.
        dev <devname> set type <type>
                Set interface type/mode.
                Valid interface types are: managed, ibss, monitor, mesh, wds.
        dev <devname> set meshid <meshid>
        dev <devname> set monitor <flag>*
                Set monitor flags. Valid flags are:
                none:     no special flags
                fcsfail:  show frames with FCS errors
                control:  show control frames
                otherbss: show frames from other BSSes
                cook:     use cooked mode
                active:   use active mode (ACK incoming unicast packets)
        dev <devname> set mesh_param <param>=<value> [<param>=<value>]*
                Set mesh parameter (run command without any to see available ones).
        dev <devname> set power_save <on|off>
                Set power save state to on or off.
        dev <devname> set bitrates [legacy-<2.4|5> <legacy rate in Mbps>*] [mcs-<2.4|5> <MCS index>*]
                Sets up the specified rate masks.
                Not passing any arguments would clear the existing mask (if any).
        dev <devname> get mesh_param [<param>]
                Retrieve mesh parameter (run command without any to see available ones).
        dev <devname> get power_save <param>
                Retrieve power save state.
Commands that use the netdev ('dev') can also be given the
'wdev' instead to identify the device.
You can omit the 'phy' or 'dev' if the identification is unique,
e.g. "iw wlan0 info" or "iw phy0 info". (Don't when scripting.)
Do NOT screenscrape this tool, we don't consider its output stable.
\$\endgroup\$
4
\$\begingroup\$

GS2, 1 byte

Code:

ç

Try it online!

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

Brain-Flak, 42 40 + 3 = 43 bytes

Try it online

((((((()()()){}){}){}){}){}){(({})[()])}

It pushes 96 and loops through pushing every number smaller than 96. This requires the -A flag to run.

I suppose I get the "gold star" for what it's worth

\$\endgroup\$
2
  • 4
    \$\begingroup\$ 42 + 3 = 47? :P \$\endgroup\$
    – DJMcMayhem
    Oct 14, 2016 at 22:57
  • 4
    \$\begingroup\$ 40 + 3 == 45? :P \$\endgroup\$
    – DJMcMayhem
    Oct 15, 2016 at 0:40
4
\$\begingroup\$

Brainfuck, 5 bytes

+[+.]

Try it online!

Explanation

Increments the byte under the data pointer, then loops while the byte under the data pointer is not zero (until the value overflows and gets back to zero), incrementing and printing the value.

\$\endgroup\$
1
  • \$\begingroup\$ Gold star! Only 3 kinds of characters! \$\endgroup\$ Oct 16, 2016 at 8:15
3
\$\begingroup\$

Jelly, 3 bytes

³RỌ

Try it online!

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

CJam, 3 bytes

'^,

Try it online!

Prints all ASCII up to and including ].

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

Pyke, 2 bytes

~a

Try it here!

Prints every char in range(0, 255)

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

Sh, 16 12 bytes

cat /dev/mem

Since you visited this page, /dev/mem must contain []()!+, and anyway statistics says your RAM must contains the characters []()!+

\$\endgroup\$
3
  • \$\begingroup\$ On x86 /dev/mem can only access memory mapped PCI regions, not RAM. \$\endgroup\$
    – anna328p
    Oct 18, 2016 at 16:44
  • \$\begingroup\$ @DmitryKudriavtsev Oh :/ \$\endgroup\$ Oct 18, 2016 at 17:28
  • \$\begingroup\$ @DmitryKudriavtsev But this don't change the fact the probability that the characters are in /dev/mem are very very high \$\endgroup\$ Oct 18, 2016 at 17:29
3
\$\begingroup\$

Perl 6, 12 bytes

put '!'..']'
put '[]()!+'
'[]()!+'.say
say ['()!+']

I think it is fairly conclusive that the minimum is 12 bytes.

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

Y, 12 bytes

∅O("[]()!+")

Outputs []()!+

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

Python 2, 13 bytes

print'[]()!+'

Prints []()!+

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

Powershell, 10 different chars, 15 bytes

[char[]](1..99)

Explanation:

[char[]](1..1000)
        (x .. y)  #Range x y
[      ]          #Cast to
 char[]           #char array
                  #implict output(arrays are seperated by \n

Don't put this in a file. Because then the implict output doesn't work!

\$\endgroup\$
1
  • \$\begingroup\$ It's significantly shorter to just output the characters as-is -- '()[]!+'. However, if output via STDERR is allowed (it's usually not), you can do something like !i, which will output an error message containing the required characters. \$\endgroup\$ Oct 17, 2016 at 13:42
0
\$\begingroup\$

05AB1E, 2 bytes

žQ

Try it online!

Pushes the printable ASCII stack and implicitly prints it. The printable ASCII character set includes the JSFk characters.

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

Text, 6 bytes

[]()!+

The challenge is quite uninteresting, so I made a quite uninteresting answer.

Also works in (Try It Online)

PHP, ///, ReRegex, Canvas, Chain, ink, Charcoal, Corea, M4, and a lot more...

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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