56
\$\begingroup\$

This seems almost trivial, but since after some effort I was not able to beat the literal solution in J, I thought it might make a decent challenge (though, to be clear, this is not a J-specific challenge).

Title says it all. You simply need to write a program, or function (taking no arguments) that returns or prints:

N NE E SE S SW W NW

You may use newlines in place of spaces.

A no-argument function returning an array of strings such as

['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW']

is also acceptable.

The letters may be upper or lower case, but may not be mixed.

\$\endgroup\$
10
  • 10
    \$\begingroup\$ Perhaps allowing them to be output in any order would be slightly more interesting \$\endgroup\$
    – Jo King
    Jun 10, 2019 at 0:14
  • 3
    \$\begingroup\$ @JoKing Sure, I'll remove that. Honestly, I didn't expect anyone to submit answers that used the full literal value -- that's not in the spirit of the question. As I state, it came up because I wasn't able to beat the literal in J, despite the string having regularity and structure of a sort. The whole point is to exploit that regularity to beat a literal answer. Bad on me for not being more explicit. Allowing them any order defeats that as well, so I don't want to make that change. \$\endgroup\$
    – Jonah
    Jun 10, 2019 at 1:27
  • 3
    \$\begingroup\$ @UnrelatedString The most promising idea I've had is to note that the directions correspond to i raised to the powers 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5. Unfortunately the J code required to then map those results into letters ended up being more expensive than a literal. \$\endgroup\$
    – Jonah
    Jun 10, 2019 at 18:04
  • 1
    \$\begingroup\$ Ah, smart! I wonder if the mapping might work better for the Gaussian integers 1, 1+i, i, -1+i, -1, -1-i, -i, 1-i so you've got one real or imaginary part per cardinal direction instead of two. It's probably harder to generate those though, unless there's some way you could round those powers of i away from 0? I don't know how easy or hard that would be in J, but it's an idea. \$\endgroup\$ Jun 11, 2019 at 2:26
  • 4
    \$\begingroup\$ It feels like entries should also show the naive "echo this string" version in their language for comparison, and judging be done on the % shortened? \$\endgroup\$ Jun 11, 2019 at 22:07

59 Answers 59

59
\$\begingroup\$

bash (24 bytes)

using brace expansion

echo N {N,,S}E S {S,,N}W

is the same length as hard coding

echo N NE E SE S SW W NW

however it becomes more interesting when outputing more points of the compass

echo N NNE NE ENE E ESE SE SSE S SSW SW WSW W WNW NW NNW

brace expansion

echo N {{N,,E}N,,{E,,S}S}E S {{S,,W}S,,{W,,N}N}W

otherwise if order could be changed, (17 bytes), the trick is that without quotes the empy string parameter disappears

echo {N,,S}{W,,E}
\$\endgroup\$
3
  • 1
    \$\begingroup\$ That is interesting, I didn't know that you could have empty position is the brace expression! \$\endgroup\$
    – flawr
    Jun 10, 2019 at 11:19
  • 1
    \$\begingroup\$ @flawr Useful when chrooting: mount -t proc{,,} \$\endgroup\$
    – gronostaj
    Jun 10, 2019 at 14:51
  • 9
    \$\begingroup\$ Or cp file{,.bak} \$\endgroup\$
    – Oliphaunt
    Jun 10, 2019 at 21:52
48
\$\begingroup\$

Mornington Crescent, 4395 3823 bytes

Take Northern Line to Bank
Take District Line to Parsons Green
Take District Line to Paddington
Take Bakerloo Line to North Wembley
Take Bakerloo Line to Charing Cross
Take Bakerloo Line to Charing Cross
Take Bakerloo Line to Charing Cross
Take Bakerloo Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Barbican
Take Circle Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Embankment
Take Bakerloo Line to Charing Cross
Take Bakerloo Line to Charing Cross
Take Bakerloo Line to Charing Cross
Take Bakerloo Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Bayswater
Take Circle Line to Hammersmith
Take Circle Line to Baker Street
Take Circle Line to Bank
Take Circle Line to Embankment
Take Northern Line to Stockwell
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Farringdon
Take Circle Line to Hammersmith
Take Circle Line to Blackfriars
Take Circle Line to Bank
Take Circle Line to Moorgate
Take Northern Line to Waterloo
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Westminster
Take Circle Line to Hammersmith
Take Circle Line to Tower Hill
Take Circle Line to Bank
Take Circle Line to Edgware Road
Take Circle Line to Liverpool Street
Take Central Line to Mile End
Take District Line to Victoria
Take Victoria Line to Seven Sisters
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take District Line to Mile End
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Barbican
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bayswater
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Baker Street
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Farringdon
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Embankment
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Blackfriars
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Moorgate
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Westminster
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Tower Hill
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Aldgate
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Edgware Road
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent

Try it online!

Since it's a bit much to expect you to read all that, let me give a quick overview of my approach. The main idea is to store 3 copies of the characters N,E,S,W at various stations on the Circle line, via Bank - Hammersmith. These characters are constructed from the start of a station name at Charing Cross. Then, construct   from the middle of a well-chosen station name using Mile End and Charing Cross, and store it at Bank so that it can be collected at Hammersmith in the concatenation. Finally, concatenate the characters one by one at Paddington, copying them again via Bank - Hammersmith if they are need to be reused later.


I think the current solution is fairly close to optimal with this strategy, at least in terms of number of stations visited: just 2 times I used a station only for transit:

  1. to get to Seven Sisters (via Victoria station)
  2. and to get back to Mornington Crescent (via Bank).

All other station visits were, if I didn't forget one, either storing/retrieving something useful or (part of) using the stations ability.

As for the line lengths, I've tried to pick the shortest names on Circle Line, but there may be a minor improvement there. It's possible that storing something on District can shave off a few bytes.

\$\endgroup\$
2
  • \$\begingroup\$ Two ideas to golf this some more: 1. take 'NE', 'SW', 'NW', 'SE' from a single station (Using e.g. Neasden, Swiss Cottage, Acton Town and Mansion House) 2. Try to exploit the fact that Paddington makes it easier to concatenate ` W ` rather than W . This does require some more overhead to 'refresh' Paddington, so it may not gain anything. \$\endgroup\$ Jun 12, 2019 at 6:45
  • 5
    \$\begingroup\$ Does this use Dollis Hill loop rules? If so, I think it can be improved by use of an Argyle Street parabola, and maybe even a slightly modified version of the Webb-Ellis protocol. \$\endgroup\$ Jun 12, 2019 at 13:38
30
\$\begingroup\$

PHP, 19 bytes

N NE E SE S SW W NW

Try it online!

Getting this out of the way. Someone will do it eventually.

\$\endgroup\$
2
  • 11
    \$\begingroup\$ Also works for HTML+JS. \$\endgroup\$
    – Cœur
    Jun 10, 2019 at 10:07
  • 3
    \$\begingroup\$ Polyglot with ///. \$\endgroup\$ Jun 12, 2019 at 4:30
27
\$\begingroup\$

brainfuck, 142 139 131 119 bytes

++++++++++[>+++>+++++++>++++++++>+++++++++<<<<-]>>>--.<<++.>>.<-.<.>.<.>>+++++.<.<.>>.<<.>>.>---.<<<.>>>.<<<.>>-----.>.

Try it online!

Simply loops 10 times to fill the cells with 30, 70, 80 and 90 then steps backward and forwards and adjusts the cell values to print out the required characters. Not much different from the standard "Hello world!".

\$\endgroup\$
6
  • 7
    \$\begingroup\$ Lol I've never understood how anyone can "golf" these obscure languages. Its hard enough to understand what the code does in the first place (this is said coming from C++ / Java background) \$\endgroup\$ Jun 10, 2019 at 0:25
  • 11
    \$\begingroup\$ @mackycheese21 what? C++ didn't teach you to love pointer manipulation? \$\endgroup\$ Jun 10, 2019 at 5:13
  • 12
    \$\begingroup\$ brainfuck might be esoteric, but I sure wouldn't call it obscure \$\endgroup\$ Jun 10, 2019 at 6:56
  • 4
    \$\begingroup\$ @candied_orange C++ taught me to hate pointer manipulation and run away whenever someone mentioned std:: :) \$\endgroup\$ Jun 10, 2019 at 15:41
  • 1
    \$\begingroup\$ @UnrelatedString obscure, no. Obtuse, yes. \$\endgroup\$
    – Rich
    Jun 10, 2019 at 18:39
20
\$\begingroup\$

Canvas, 12 bytes

>X½+T)AuS{⁹‟

Try it here!

The string, simply compressed.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Can you explain how this works in a little more detail? \$\endgroup\$
    – Dillanm
    Jun 10, 2019 at 12:51
  • 4
    \$\begingroup\$ @Dillanm there isn't much more to say - Canvas has a built-in compressor (should be accessible with ctrl+o → string compress) that, here, simply stores the characters needed ("NESW ") and then in base-5 stores the individual characters. \$\endgroup\$
    – dzaima
    Jun 10, 2019 at 12:56
15
\$\begingroup\$

Brain-Flak, 204 bytes

((((((((((((((((()()()){}()){}){}())){}{}))<([([][]){}()]{})(([][]){}[])>)<([][]
()())>)[[]]()())<([]()()())>)<((([]())[][]){}[][()])>)<([][()()])>[[]()])<([][((
)()){}])>)((()()())){}{})<((()()()()()){})>)

Try it online!

\$\endgroup\$
1
  • 4
    \$\begingroup\$ Points deducted for wrapping. \$\endgroup\$
    – Rich
    Jun 10, 2019 at 18:40
14
\$\begingroup\$

MarioLANG, 249 221 bytes

+
+
+
+
+
+
+
+
+  ((+++++++++)))<
+>==============="
)++++++++)+++((-[!)--.)++.(.---------.).(.).)++.((.).).(.).++++.(.).(.(+++++++++.))
=================#================================================================.

Try it online!

\$\endgroup\$
13
\$\begingroup\$

Excel Formula, 59 57 bytes

The following should be entered as an array formula (Ctrl+Shift+Enter):

=SUBSTITUTE(ADDRESS(1,{14,369,5,499,19,517,23,387},4),1,)

After entering the formula as an array formula, highlight it in the formula bar and evaluate it using F9 to return the result, for example:

Before:
Before formula evaluation

After:
Before formula evaluation

How it works

The ADDRESS function returns a string representing a reference based on two parameters, row and col. The third parameter controls what type of reference is returned, an absolute or relative reference. For example, =ADDRESS(1,2,4) returns "B1".

We can supply an array to ADDRESS and use it as an array formula to return multiple results, for example =ADDRESS(1,{1,2,3},4) returns "A1","B1","C1".

Therefore, in my answer, the array supplied to ADDRESS are just the column numbers relating to the required compass points, e.g. Column 14 is column N, Column 369 is column NE.

However, we are not finished here since all the returned references have the row included, for example, N1, NE1. Therefore, we simply use SUBSTITUTE to remove the 1 from all references.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Would =IF(1,"N NE E SE S SW W NW") be valid? \$\endgroup\$
    – squid
    Jun 10, 2019 at 20:20
  • 3
    \$\begingroup\$ @squid Yes it would indeed! However, I was going for an alternative which didn't require the string to be quoted verbatim. \$\endgroup\$ Jun 10, 2019 at 21:38
  • \$\begingroup\$ How does this work? \$\endgroup\$
    – anatolyg
    Jun 11, 2019 at 18:58
  • \$\begingroup\$ @anatolyg I've added an explanation section, hope it's understandable. \$\endgroup\$ Jun 12, 2019 at 8:51
  • \$\begingroup\$ the CSE keystrokes are no longer as of Excel 2021; also the poster has removed the requirement that output be in order, so you may be able something along the lines of ={"","N","S"}&{"";"E";"W"} now \$\endgroup\$ Feb 28, 2022 at 17:40
11
\$\begingroup\$

Deadfish~, 188 183 bytes

-5 thanks to squid

iiissdddc{ddddd}iiiicdddd{iiiii}c{d}ic{dddd}iiicddd{iiii}c{dddd}iiic{iiiii}ic{d}ddddc{dddd}iiic{iiiii}ic{ddddd}dci{iiiii}ciiiic{ddddd}dddddciiiii{iiiii}c{ddddd}dddddcdddd{iiiii}c{i}dc

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ {i}dc at the end for 183 \$\endgroup\$
    – squid
    Jun 10, 2019 at 9:40
10
\$\begingroup\$

Triangularity, 71 bytes

..... .....
...."W"....
..."W N"...
.." SW "+..
." SE S"++.
"N NE E"+  

Try it online!

There are two spaces on the last line to hit the byte count Triangularity requires.

\$\endgroup\$
8
\$\begingroup\$

Charcoal, 14 bytes

”{⊟“�_Zn↖⦄RüΦ≦

Try it online! Link is to verbose version of code... which is just the string to be printed, as the auto-deverbosifier takes care of the string compression.

Printing the string uncompressed takes 19 bytes, since Charcoal prints printable ASCII literally. The best algorithmic answer I could come up with unfortunately takes 20 bytes:

E⁸ΦSNWE›³﹪⁻﹪⁺⁵×⁶μχι⁸

Try it online! Outputs using array format (would cost two bytes to join the elements on spaces). Works by noticing that the letters of the string SNWE are used only when the current outer index equals or is 1 away (modulo 8) in either direction from the corresponding element of the list of indices 4,0,6,2.

\$\endgroup\$
8
\$\begingroup\$

Python 2, 62 61 58 53 bytes

i=8
while i:print'NESESWNW'[~i+(i==4):][:1+i%2],;i-=1

Try it online!

Not great, but at least not a plain print..

\$\endgroup\$
8
\$\begingroup\$

brainfuck, 117 bytes

+++++[>++++++>+>+++>>++++>+++++<<<<<<-]>++[>++>++>+>++>++[<]>-]>>-.>.<.<.>>.<<.>>.>-.<<<.>>.>.<.>.>--.<<.>>.<<.<.>>>.

Try it online!

This code will first create the characters "EN SW" into the memory and then move back and forth to print them. The space is in the middle, because it is printed most often. N and S and W and E never appear together so they are on opposite sides of the memory. For optimization some of the final decrements happen during the output phase.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ OK, that's a cool answer. Guess you beat me on this one. +1 for -1 :-) \$\endgroup\$
    – ElPedro
    Jun 12, 2019 at 21:30
  • 1
    \$\begingroup\$ BTW, forgot to say, welcome to the Code Golf site. Looking forward to competing with you in the future ☺ \$\endgroup\$
    – ElPedro
    Jun 12, 2019 at 21:39
  • 1
    \$\begingroup\$ Welcome! Consider adding an explanation or a link to an online interpreter for the program. See other answers for examples. Short code-only answers tend to get automatically flagged as low-quality. \$\endgroup\$
    – mbomb007
    Jun 12, 2019 at 21:41
  • 1
    \$\begingroup\$ Thanks, I can add a explanation of my code. I will also try to understand how the online links work. \$\endgroup\$
    – Helena
    Jun 13, 2019 at 17:35
  • 1
    \$\begingroup\$ @Helena For the link you can check out the "Try it Online" link on my answer. If you paste your code in and run it you can then click on the link icon and get a perfectly formatted code golf answer that you can simply copy and paste here. Works like magic and supports many languages. Well worth a try. \$\endgroup\$
    – ElPedro
    Jun 13, 2019 at 17:49
6
\$\begingroup\$

Jelly,  16  15 bytes

“¤œỵpq⁵’ṃ“NESW 

A full program printing the text

Try it online!


16...

“¥Þ¡¦¢¬£æ‘ṃ“¡ɱ⁻»

A niladic Link which yields a list of lists of (lowercase) characters.

Try it online!


Alternative 15 as a niladic Link which yields a list of (lowercase) characters (with spaces): “¡XÇŀqỵÑ’ṃ“¡⁴ṁ».

\$\endgroup\$
6
\$\begingroup\$

Commodore BASIC (TheC64Mini, C64, C128, VIC-20 etc.) 28 Tokenized BASIC bytes used

 0 PRINT"N NE E SE S SW W NW

In Commodore BASIC, you do not require the closing quotation mark on PRINT or LET statements as the interpreter will auto-close it, this saves one BASIC token.

Alternatively, one may simply use direct mode as follows:

Commodore BASIC 23 PETSCII characters (+ RETURN to execute)

?"N NE E SE S SW W NW

I'm not sure how to count the number of bytes used in this instance as according to the interpreter ? and PRINT use the same number of bytes, and there is no program stored in memory.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ PRINT can be replaced with ? as well, saving four bytes. \$\endgroup\$
    – James
    Jun 12, 2019 at 4:08
  • 1
    \$\begingroup\$ No, that's not true; PRINT and ? use the same amount of BASIC tokens. I'm not counting PETSCII characters as it's not very representative of how much of the available memory is being used by the interpreter. \$\endgroup\$ Jun 12, 2019 at 8:52
  • 1
    \$\begingroup\$ After all of these years I'm still learning new stuff about the Commodore. Thanks Shaun! c64-wiki.com/wiki/BASIC_token \$\endgroup\$
    – James
    Jun 13, 2019 at 10:07
  • \$\begingroup\$ Here's one I made earlier (for the C64) -> pastebin.com/NMYzTC7k \$\endgroup\$ Jun 13, 2019 at 12:23
6
\$\begingroup\$

Vyxal, 13 bytes

«ƛ.←√Fǎ⁰ɾ@=½•

Try it Online!

-1 thanks to AaronMiller

Vyxal forever lads, it has crushed 05AB1E and Jelly I am so proud

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

Deadfish~, 138 bytes

{{i}i}c{{d}}cs{i}c{d}ic{{d}}iisicsic{{d}}iisicisddddddc{d}ddddc{{d}}iisicisddddddc{{iiii}}sicisddddddciiiic{{d}d}icisddc{{d}d}ics{i}c{i}dc

Try it online!

So, outputting in lower-case with newlines is better than default (upper-case with spaces).

This code was generated by my optimizer, written in C++ (thanks to squid for another optimization idea!):

#include <iostream>
#include <string>
#include <queue>
#include <vector>


int eval(const std::string& actions, int result)
{
    int mult = 1;

    for (int i = 0; i < (int)actions.length(); ++i)
    {
        switch (actions[i])
        {
        case 's':
            result *= result;
            if (result == 256)
                result = 0;
            break;

        case '{':
            mult *= 10;
            break;

        case '}':
            mult /= 10;
            break;

        case 'd':
            if (result > 256 && result - mult <= 256)
                result = (result - mult) % 256;
            else
                result -= mult;
            break;

        case 'i':
            if (result < 256 && result + mult >= 256)
                result = (result + mult) % 256;
            else
                result += mult;
            break;
        }
    }

    return result;
}

struct worse
{
    bool operator()(const std::string& a1, const std::string& a2)
    {
        return a1.length() > a2.length();
    }
};

std::string BestStr(int accumulator, int target)
{
    std::priority_queue<std::string, std::vector<std::string>, worse> actions;
    actions.push(std::string(""));
    while (true)
    {
        std::string a = actions.top();
        int new_acc = eval(a, accumulator);
        if (new_acc == target)
            return a + "c";

        actions.pop();

        int last_braces = 0;
        int i = a.length() - 1;
        while (i >= 0 && a[i] == '}' && last_braces < 2)
        {
            ++last_braces;
            --i;
        }
        bool is_last_i = (i >= 0 && a[i] == 'i');
        bool is_last_d = (i >= 0 && a[i] == 'd');
        bool may_add_braces = (i < 0 || a[i] == 's');
        bool may_add_c = (new_acc > 1 && new_acc < 30);

        if (may_add_c)
        {
            actions.push(a + "s");
        }
        if (may_add_braces)
        {
            actions.push(a + "{{}}");
            actions.push(a + "{}");
        }
        for (int braces_back = 0; braces_back <= last_braces; ++braces_back)
        {
            for (int c = 'd'; c <= 'i'; c += 'i' - 'd')
            {
                if ((!is_last_i || c == 'i') &&
                    (!is_last_d || c == 'd') ||
                    braces_back == 0)
                {
                    std::string new_actions = a;
                    new_actions.insert(new_actions.length() - braces_back, 1, (char)c);
                    actions.push(new_actions);
                }
            }
        }
    }
}

std::string DeadfishConvert(std::string s)
{
    std::string result;
    int accumulator = 0;

    for (int c: s)
    {
        result += BestStr(accumulator, c);
        accumulator = c;
    }
    return result;
}

int main()
{
    std::string s1 = DeadfishConvert("N NE E SE S SW W NW");
    std::cout << s1 << '\n';
    std::cout << s1.length() << '\n' << '\n';
    std::string s2 = DeadfishConvert("n ne e se s sw w nw");
    std::cout << s2 << '\n';
    std::cout << s2.length() << '\n' << '\n';
    std::string s3 = DeadfishConvert("N\nNE\nE\nSE\nS\nSW\nW\nNW");
    std::cout << s3 << '\n';
    std::cout << s3.length() << '\n' << '\n';
    std::string s4 = DeadfishConvert("n\nne\ne\nse\ns\nsw\nw\nnw");
    std::cout << s4 << '\n';
    std::cout << s4.length() << '\n' << '\n';
}
\$\endgroup\$
1
  • 1
    \$\begingroup\$ 155 \$\endgroup\$
    – squid
    Jun 11, 2019 at 13:42
4
\$\begingroup\$

Japt, 16 bytes

Returns an array of lowercase strings. The compressed string was 18 bytes but using a as the delimiter instead and then splitting on that worked out shorter.

`nÂà!Z°°nw`qa 

Try it - footer formats the output.

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

Whitespace, 151 bytes

[S S S T    T   N
_Push_3_W][S S T    T   T   S N
_Push_-6_N][S S T   T   T   S T S S N
_Push_-52_space][S S S T    T   N
_Push_3_W][S T  S S T   N
_Copy_0-based_1st_(space)][S S S T  T   N
_Push_3_W][S S T    T   N
_Push_-1_S][S T S S T   S N
_Copy_0-based_2nd_(space)][S S T    T   N
_Push_-1_S][S T S S T   N
_Copy_0-based_1st_(space)][S S T    T   T   T   T   N
_Push_-15_E][S S T  T   N
_Push_-1_S][S T S S T   S N
_Copy_0-based_2nd_(space)][S T  S S T   S N
_Copy_0-based_2nd_(E)][S T  S S T   N
_Copy_0-based_1st_(space)][S T  S S T   N
_Copy_0-based_1st_(E)][S S T    T   T   S N
_Push_-6_N][S T S S T   S N
_Copy_0-based_2nd_(space)][S S T    T   T   S N
_Push_-6_N][N
S S N
_Create_Label_LOOP][S S S T S T S T S S N
_Push_84][T S S S _Add][T   N
S S _Print_as_character][N
S N
N
_Jump_to_Label_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs, and new-lines only).

Explanation:

  1. Push the unicode values minus constant 84 for the characters "WN W WS S ES E EN N" to the stack (note that the string is pushed in reversed). In addition, I use a few copies of previously pushed values to save bytes where possible.
  2. Then start an infinite loop, which does the following:
    1. Add the constant 84 to the current unicode value
    2. Print it as character to STDOUT

The constant 84 is generated by this Java program which I wrote for another challenge I answered in Whitespace.

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

Batch File, 19 bytes

The question never stated that you had to output N NE E SE S SW W NW and nothing else, nor that it couldn't exit due to error after doing so this code only throws an error but does not exit due to it.

N NE E SE S SW W NW

Output

>N NE E SE S SW W NW
'N' is not recognized as an internal or external command,
operable program or batch file.

Batch File, 25 bytes

Only N NE E SE S SW W NW output with no errors or crashes.

@echo N NE E SE S SW W NW
\$\endgroup\$
1
  • \$\begingroup\$ You could save a byte replacing cd with just quotes, like 'N NE E SE S SW W NW' - you'll get something like: N NE E SE S SW W NW - command not found \$\endgroup\$ Jun 11, 2019 at 22:05
4
\$\begingroup\$

Python2, 59 bytes

''.join(' SEWN'[0xe0619042210504>>i*3&7]for i in range(19))

The magic number is the joined three-bit indexes into the character string, reverse order so we can start iterating at the LSB.


I spent a while trying to shrink the magic number, but repeating the character string via multiply to allow for extra indexes doesn't work out due to needing to encode for space - best I got for overlapping indexes in the lookup added more characters to the string than digits removed from the magic number (including a couple of unfortunate don't-cares in the middle):

''.join('WN S ES W xxE '[0x423659711>>i*2&15]for i in range(19))
\$\endgroup\$
1
  • \$\begingroup\$ Why make ir simple when you can make it complicated? :-) \$\endgroup\$
    – G B
    Jun 12, 2019 at 5:40
4
\$\begingroup\$

CSS, 42 39 bytes

(thanks to a stone arachnid for the revised version)

body:after{content:"N NE E SE S SW W NW"

\$\endgroup\$
2
  • 1
    \$\begingroup\$ -3 bytes: body:after{content:"N NE E SE S SW W NW" \$\endgroup\$ Jun 12, 2019 at 4:08
  • \$\begingroup\$ Oh I forgot, that's valid as well ofc, updated :)! \$\endgroup\$
    – roberrrt-s
    Jun 12, 2019 at 9:40
4
\$\begingroup\$

Hodor, 177 bytes

hodor.hod("HoOodoOorhodor  HoOodoOorhodor HooodorrHodor  HooodorrHodor  HODOR?!? HooodorrHodor  HODOR?!?  HODOR?!? Hooodorrhodor  Hooodorrhodor  HoOodoOorhodor Hooodorrhodor ");

Try it online!

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

K (ngn/k), 23 22 bytes

-1 byte thanks to ngn!

"WNES"@5\7108085518230

Try it online!

J, 34 30 bytes

echo(#:3510)<;.1'NNEESESSWWNW'

Try it online!

\$\endgroup\$
9
  • \$\begingroup\$ Galen, for J echoing the literal would be shorter. I would love to see that beat... I haven’t managed to do it \$\endgroup\$
    – Jonah
    Jun 10, 2019 at 7:32
  • 1
    \$\begingroup\$ Yes, echoing would be be 4+19 bytes. I don't have any better ideas to. \$\endgroup\$ Jun 10, 2019 at 7:40
  • 1
    \$\begingroup\$ for k: if we swap " "<->"W" (0<->4 in base 5), the space will be at the end and we can remove it because out-of-bounds string indexing gives a space anyway: "WNES"@5\7108085518230 \$\endgroup\$
    – ngn
    Jun 17, 2019 at 14:01
  • 2
    \$\begingroup\$ @GalenIvanov good for top-performance databases too :) arthur designed k as the underlying language for kdb+ \$\endgroup\$
    – ngn
    Jun 18, 2019 at 8:17
  • 1
    \$\begingroup\$ @HenryHenrinson \: in k4 (q), \ in k5, \ in k6, and it looks like it's gonna be \: again in k7 (shakti). my dialect is close to k6 mostly \$\endgroup\$
    – ngn
    Jun 20, 2019 at 11:57
4
\$\begingroup\$

MathGolf, 20 17 bytes

ÿnesw▒∙╫m+mÉîÄ╪^─

-3 bytes thanks to @maxb.

Try it online.

Explanation:

ÿnesw      # Push 4-char string "nesw"
           #  STACK: "nesw"
     ▒     # Split to a list of characters
           #  STACK: ["n","e","s","w"]
      ∙    # Triplicate it
           #  STACK: ["n","e","s","w"],["n","e","s","w"],["n","e","s","w"]
╫          # Rotate the top one once towards the left
           #  STACK: ["n","e","s","w"],["n","e","s","w"],["e","s","w","n"]
 m+        # Append the top two together
           #  STACK: ["n","e","s","w"],["en","se","ws","nw"]
   m       # Map the strings in the top list to:
    ÉîÄ╪   #  Rotate the string the 1-based index amount of times towards the right
           #   STACK: ["n","e","s","w"],["ne","se","sw","nw"]
^          # Zip; creating pairs with the top two lists
           #  STACK: [["n","ne"],["e","se"],["s","sw"],["w","nw"]]
 ─         # Flatten this list
           #  STACK: ["n","ne","e","se","s","sw","w","nw"]
           # (after which the entire stack is output implicitly as result)
\$\endgroup\$
4
  • 1
    \$\begingroup\$ 17 bytes. This was a fun challenge. I tried it before, but ended up where you did. I think the most you could do from this is 1 byte more, but I couldn't find a shorter way. \$\endgroup\$
    – maxb
    Jun 12, 2019 at 7:58
  • \$\begingroup\$ @maxb Ah nice approach. I must admit that those code of block-size X (É and Ä in this case) still confuse me a bit sometimes.. Sometimes I'm not sure when I do or don't have to use those code-blocks. Your m+ doesn't use one for example. But your Ä is a code-block of size 1. I tried mÅî╪ just yet to see what happened, which is why I now understand why there is a code-block of size 1 Ä to begin with. :) ) Thanks for the -3 bytes, though. Still a lot to learn I see. \$\endgroup\$ Jun 12, 2019 at 8:20
  • 1
    \$\begingroup\$ Nice explanation! I tried doing a solution without converting it to a list of chars, but the zip command was a bit wonky. For the code blocks, think of them as replacements, used instead of {}. mÅî╪ creates the mapping, but it doesn't have a for-loop inside the mapping. If you write m{î{╪}}, it is perhaps easier to see that the code is "map to: loop <index> times, and rotate the string each loop". The reason why m+ does not have one is that certain commands have implicit 1-byte blocks (map, filter, reduce, etc), but î is not a command meant to be used in combination with a block. \$\endgroup\$
    – maxb
    Jun 12, 2019 at 8:24
  • 1
    \$\begingroup\$ @maxb I indeed knew the code-blocks were a shorter variant of {...}, but I kinda forgot integer{ is a for-loop. :) Now the îÄ╪ makes a lot more sense. Thanks for the explanation! \$\endgroup\$ Jun 12, 2019 at 8:30
4
\$\begingroup\$

Seed, 4251 bytes

27 860147400464320299851319650217038525067593962313164914063802148270004754537839527004961550644011737763173154284403302082858336215121754817673301632815648307157082257250065969906234717399421909542980478171410880440751722628315229816701382847058322399070856858731820592153559264698086256217073752803742509491363133456184161014315870765856600563476019957791284745304281660469000032221201987453977657076508857068925011334779959071440923984103143261670811286681623926107584024737407335854701183247862900875519132553862748352119660143037154122195573484790384903915970480907443474210394470962277045139788233096906291178764592241041611441485846755897013873688521530706196990820905883449849751950542262212135591408570969484383431331268013190679834203987004737033313790768284011421240552315405082211961547940945234054982540700959040110356065461918175100640645479538002873406489037076456708483336597830606103157984606500496104240680721715484975347636031339682884674007607761345031515356027627047153497243272493312777270059024405453326103645777154783737896705880974153479385405461479666492424804798913240004709514175124491345454890697719341525477491425506610736434419234873135671474320918887316021471114682305222060888267915897813615746066948876815582512745575223896397735870135010211620878858423461465501063112149784622948077561122339504363312618787910627004536262109268282720077104133896334152799286447973176850047049812237713119532715197762392242720792955229362464454600594810210467053711629390655097050460183390576348650022884751999375732126411381491754798404626390434531750738731272129720457996733567288607018123496287262160638316644435886734080491415247676750503867190420441091488618537213370224085728523393619833129203818082398409724941259872470927203359894330981108281123358998365863404548111735330153890675493224241792528725858340777392950394427682710593902374005599390211202010183187773313755391636819970533772133030396082626453690202239163311449200997783715732798122360869214085295495205587704852617986211913577714214894103975695818432639029127400486966542504511176639066696550158657913890844890562994316733022295096182193874563287743954751083012315029203163625022641203785665910088174692911838388292883069099394602294401738461660317279173837890672723734359376951296954419885743000344118132620159094589745339998487533132912807955511930376108281742417048694994875241588696652295801421718174803743124679206340225332097286300793979362905965159380929127793048151559525010844247959055728814555227894949967607223815007539935866407118545974733499467978719520674830213387424230607171033962289851248037814785709294099111079872519162461838713157037955879646633307327632199374397038125921466729486072989316466253855183888968132751168378559192389783877180105811003888702407695849761551983252272136707803738209259164664868613103576660297351725095830903937947897824922994115970348394937807639806260540922571073766242821778449979029518064508677282684721476618711020644303120169502947696562952368545317073951472329943172059804905148953167123224802341970130868655853508010679907291864781248708382895527072805076419959404999796416487609739366680312473571591439396203866000938847930213950479915383946224278267661324765517520245110902687465374197341697248788763795723636008536927460160699589679376204284666762952828550700427849440153722541367837884874936070390103822579251528194036368492691743157507007441316773257650566047289586030443027248477537583575486086849301248855085404298181531070581096279202982969807660922182894833612275870735415456262697094185364902898042294060753067768982931035992143317507864980963267558535182176412835015890947861515892664431426681784697668827491173215527175448012211609218424524444896026378969503208454034161694651869812191979848741948472549690935926453753636695759524608297815672107532614104226930403335546065437317024985496835938364395583613835089520335424746078337656399280976500954797578444275697683434911793855960947914672558887185471712327031861804193341374816922655961374046504439546326688852794774993974104827407822683150065349462048012229814913150474813478266062076194247990327161206357488393540333896367735722260126440026734314269599013734005627347044302569936610219118261640990110423736786326407200834287772995647774230547965

Try it online!

\$\endgroup\$
5
  • \$\begingroup\$ -1724 bytes. \$\endgroup\$
    – apollyon
    Feb 20, 2022 at 21:34
  • \$\begingroup\$ @awi I golfed it with my current generator even further. now my solution is 20 bytes smaller than yours. \$\endgroup\$ Feb 21, 2022 at 7:53
  • \$\begingroup\$ now 40 bytes smaller. \$\endgroup\$ Feb 22, 2022 at 8:09
  • \$\begingroup\$ How long does it take for your generator to find these solutions? Mine takes 1-10 minutes. \$\endgroup\$
    – apollyon
    Feb 22, 2022 at 18:46
  • \$\begingroup\$ @awi around a minute. \$\endgroup\$ Feb 22, 2022 at 18:56
3
\$\begingroup\$

05AB1E, 14 bytes

.•2Àβ‡yÞJŒ¾oÒ8

Try it online!

This prints out the string except lowercase.

\$\endgroup\$
1
  • \$\begingroup\$ Just remove the final for -1 \$\endgroup\$
    – Grimmy
    Jun 9, 2019 at 22:12
3
\$\begingroup\$

JSFuck, 8529 bytes

[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]])+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]])()([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(+[![]]+[])[+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(+[![]]+[])[+[]]+(!![]+[])[+[]]+[+!+[]]+[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[+!+[]]+[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]]+[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[+!+[]]+[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]]+[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]]+[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(+[![]]+[])[+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+!+[]])[(![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]]((!![]+[])[+[]])[([][(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]](([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(![]+[+[]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]]+![]+(![]+[+[]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]])()[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[+[]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]])+[])[+!+[]])+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]])())

Just for the fun of it

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

Brachylog, 18 bytes

"NeSw"it;?↺₍h₂a₀oụ

Try it online!

Semi-port of my Jelly solution. Generates each direction.

"NeSw"                Let the input variable be "NeSw".
      i               Take a pair [element, 0-index] from it,
       t              extract the index,
        ;?↺₍          and rotate the input variable left by that many places.
            h₂        Keep only the first two elements of the rotation,
              a₀      take a prefix (nonempty, shortest first) of it,
                o     sort (putting uppercase before lowercase),
                 ụ    and fold to uppercase.

Barely beats my original...

Brachylog, 19 bytes

"NNEESESSWWNW"ḍ₄ḍᵐc

Try it online!

Outputs as a list. ḍ₄ḍᵐc saves two bytes over writing out seven spaces and making the entire predicate a string literal, so at least it ties PHP...

"NNEESESSWWNW"         The string "NNEESESSWWNW"
              ḍ₄       split into quarters
                 ᵐ     with each quarter
                ḍ      split in half
                  c    and concatenated
                       is the output.
\$\endgroup\$
2
\$\begingroup\$

PowerShell, 21 bytes

'N NE E SE S SW W NW'

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Same in Swift Playground, with "N NE E SE S SW W NW", if you want. But too trivial to post. \$\endgroup\$
    – Cœur
    Jun 10, 2019 at 10:03
  • 4
    \$\begingroup\$ this is code golf. see not trivial in the edit history. \$\endgroup\$
    – mazzy
    Jun 10, 2019 at 12:04

Your Answer

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

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