答:
BASH, 69, 59 bytes

UPDATE

Another nice way to do this in bash is to use tr (62 bytes, but can probably be squeezed a bit more)

```<code>T() { m=`bc<<<$1^3`;[ -z "`tr -d $m <<<$1;tr -d $1 <<<$m`" ];}
</code>```

EDIT: Some more optimizations (Thx ! @manatwork)

Golfed

```<code>T() { S(){ fold -1|sort -u;};bc<<<$1^3|S|diff - <(S<<<$1);}
</code>```

Test

```<code>TEST() {
 T $1 >/dev/null; echo $?
}

TEST 0
0
TEST 1
0
TEST 11
1
TEST 10
0
TEST 107624
0
TEST 251894
0
TEST 251895
1
TEST 102343
1
TEST 106239
1
</code>```

0 - for success (exit code)
1 - for failure (exit code)

Body:
BASH, 69, 59 bytes

UPDATE

Another nice way to do this in bash is to use tr (62 bytes, but can probably be squeezed a bit more)

T() { m=`bc<<<$1^3`;[ -z "`tr -d $m <<<$1;tr -d $1 <<<$m`" ];}

EDIT: Some more optimizations (Thx ! @manatwork)

Golfed

T() { S(){ fold -1|sort -u;};bc<<<$1^3|S|diff - <(S<<<$1);}

Test

TEST() {
 T $1 >/dev/null; echo $?
}

TEST 0
0
TEST 1
0
TEST 11
1
TEST 10
0
TEST 107624
0
TEST 251894
0
TEST 251895
1
TEST 102343
1
TEST 106239
1

0 - for success (exit code)
1 - for failure (exit code)


问:
The Art of Word Shaping

The Art of Word Shaping

Given a binary matrix and a string of letters, replace all 1's in the matrix, moving from top to bottom and from left to right within each row, with the letters of the string. Once the letters have been formed into the shape of the matrix, print the matrix, replacing 0's with spaces. It's probably easier to just give an example or two.

Case: Base case...

Input One:

```<code>[0,0,1,0,0]
[0,1,0,1,0]
[1,0,0,0,1]
[0,1,0,1,0]
[0,0,1,0,0]

"PPCGPPCG"
</code>```

Output One:

```<code>  P
 P C
G   P
 P C
  G
</code>```

Case: If the input string is longer than the number of ones...

Input Two:

```<code>[1,0,0]
[0,1,0]
[1,0,1]

lambda
</code>```

Output Two:

```<code>l
 a
m b
</code>```

Case: If the input string is shorter than the number of ones...

Input Three:

```<code>[1,1,1]
[1,0,1]
[1,1,1]

PPCG
</code>```

Output Three:

```<code>PPC
G P
PCG
</code>```

Available Assumptions

You may assume the input string is never empty.

You may assume the matrix will never be empty.

You may not assume that the binary matrix will never be all zeros.

Rules

If the string is shorter than the number of ones, repeat the string; all ones must be replaced.

If the string is longer than the number of ones, only use what is needed.

You may use True/False in place of integers/bits for the input.

Trailing spaces ARE REQUIRED, all zeros must be replaced with spaces.

A single trailing newline is acceptable.

This is code-golf, lowest byte count wins.

答:
Python 3, 104 (or 83) Bytes

```<code>import itertools as i
def f(s,L):s=i.cycle(s);return'\n'.join(' '.join(next(s)*e for e in l)for l in L)
</code>```

There is shorter option (83 Bytes), but it will fail if string is more than 999 times shorter than needed:

```<code>def f(s,L):s=list(s)*999;return'\n'.join(' '.join(s.pop(0)*e for e in l)for l in L)
</code>```

ContentLicense: CC BY-SA 4.0

Title: The Art of Word Shaping

Body:
Python 3, 104 (or 83) Bytes

import itertools as i
def f(s,L):s=i.cycle(s);return'\n'.join(' '.join(next(s)*e for e in l)for l in L)

There is shorter option (83 Bytes), but it will fail if string is more than 999 times shorter than needed:

def f(s,L):s=list(s)*999;return'\n'.join(' '.join(s.pop(0)*e for e in l)for l in L)

ContentLicense: CC BY-SA 3.0


问:
Determine the color of a chess square
Your challenge is to write a program that outputs the color of a given square from the chessboard. This is how a chessboard looks:

You can see that the square a1 is dark, and h1 is a light square. Your program needs to output dark or light, when given a square. Some examples:

```<code>STDIN:  b1
STDOUT: light

STDIN:  g6
STDOUT: light

STDIN:  d4
STDOUT: dark
</code>```

The rules:

You need to provide a full program that uses STDIN and uses STDOUT to output dark or light.

Assume that the input is always valid ([a-h][1-8])

This is code-golf, so shortest amount of bytes wins!

Scoreboard

var QUESTION_ID=63772,OVERRIDE_USER=8478;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"http://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
><> Fish 26 bytes

```<code>d"darkthgil"ii+2%?!rooooo;
</code>```

A spin on the already posted fish code by sp3000.

It uses the same based checking with mod but with a few changes.

Using 1 line allows us to save 6 bytes (1 for the new line, 2 for directional instructions and 3 for the jump instructions)

Lose 1 byte to placing a [CR] onto the stack but it allows us to use 5 prints on both answers.

Lose 1 byte to reversing the stack [r] when needed for an answer.

Lastly putting both answers on the stack in 1 string allows us to save 2 bytes not having to use ["] twice.

Title: Determine the color of a chess square

Body:
><> Fish 26 bytes

d"darkthgil"ii+2%?!rooooo;

A spin on the already posted fish code by sp3000.

It uses the same based checking with mod but with a few changes.

Using 1 line allows us to save 6 bytes (1 for the new line, 2 for directional instructions and 3 for the jump instructions)

Lose 1 byte to placing a [CR] onto the stack but it allows us to use 5 prints on both answers.

Lose 1 byte to reversing the stack [r] when needed for an answer.

Lastly putting both answers on the stack in 1 string allows us to save 2 bytes not having to use ["] twice.


问:
Do n and n^3 have the same set of digits?
Given a number n (0 <= n <= 2642245), check if n and n3 have the same set of digits, and output a truthy or falsey value accordingly.

For example, let's check the number 100.

1003 is 1000000.

The set of digits in 100 is {0, 1}.

The set of digits in 1000000 is {0, 1}.

Therefore, 100 should give a truthy value.

Test cases

```<code>0 -> True
1 -> True
10 -> True
107624 -> True
251894 -> True
251895 -> False
102343 -> False
</code>```

Remember, this is code-golf, so the code with the fewest bytes wins.

OEIS A029795

答:
JavaScript (ES6), 44 bytes

```<code>g=n=>n<1?0:g(n/10)|1<<n%10
n=>g(n)==g(n*n*n)
</code>```

Port of @KarlNapf's excellent C answer. ES7 saves a byte via n**3. Only works up to 208063 due to JavaScript's limited numeric precision; if you only need it to work up to 1290, you can save another byte.

Body:
JavaScript (ES6), 44 bytes

g=n=>n<1?0:g(n/10)|1<<n%10
n=>g(n)==g(n*n*n)

Port of @KarlNapf's excellent C answer. ES7 saves a byte via n**3. Only works up to 208063 due to JavaScript's limited numeric precision; if you only need it to work up to 1290, you can save another byte.


答:
J, 18 bytes

```<code>-:&(/:~)&~.&":^&3x
</code>```

I think this is the most&s I've used in an answer to date. This is a fork:

```<code>-:&(/:~)&~.&": ^&3x
</code>```

The verb on the right, ^&3x, raises the argument to the 3rd power, converting to an extended number if necessary. Then, the verb on the left takes right arg (cubed arg) and left arg (arg). & applies the verb following to each argument, then passes each argument to the preceding function. So, this is:

```<code>-:&(/:~)&~.&":
            ":  string representation
         ~.     unique elements
   (/:~)        sorted
-:              are the same
</code>```

Test cases

```<code>   f=:-:&(/:~)&~.&":^&3x
   (,. f"0) 0 1 10 107624 251894 251895 102343
     0 1
     1 1
    10 1
107624 1
251894 1
251895 0
102343 0
   f 251894
1
   f 251895
0
</code>```

Title: Do n and n^3 have the same set of digits?

Body:
Given a number n (0 <= n <= 2642245), check if n and n3 have the same set of digits, and output a truthy or falsey value accordingly.

For example, let's check the number 100.

1003 is 1000000.

The set of digits in 100 is {0, 1}.

The set of digits in 1000000 is {0, 1}.

Therefore, 100 should give a truthy value.

Test cases

```<code>0 -> True
1 -> True
10 -> True
107624 -> True
251894 -> True
251895 -> False
102343 -> False
</code>```

Remember, this is code-golf, so the code with the fewest bytes wins.

OEIS A029795

Body:
J, 18 bytes

-:&(/:~)&~.&":^&3x

I think this is the most&s I've used in an answer to date. This is a fork:

-:&(/:~)&~.&": ^&3x

The verb on the right, ^&3x, raises the argument to the 3rd power, converting to an extended number if necessary. Then, the verb on the left takes right arg (cubed arg) and left arg (arg). & applies the verb following to each argument, then passes each argument to the preceding function. So, this is:

-:&(/:~)&~.&":
            ":  string representation
         ~.     unique elements
   (/:~)        sorted
-:              are the same

Test cases

   f=:-:&(/:~)&~.&":^&3x
   (,. f"0) 0 1 10 107624 251894 251895 102343
     0 1
     1 1
    10 1
107624 1
251894 1
251895 0
102343 0
   f 251894
1
   f 251895
0


问:
Render "Digital Clock Style" Numbers
Write the shortest program which will take a string of numbers (of up to at least 20 length) as input, and display the output using the standard digital clock style numbers.  For instance for input 81, a solution with ascii output would give:

```<code> _
|_|  |
|_|  |
</code>```

Graphical output is also acceptable, if it helps.

ContentLicense: CC BY-SA 2.5

Title: Render "Digital Clock Style" Numbers

Body:
Golfscript - 97 chars

:*{32' _':$@'14'{?~!=}:&~32}%n*{:x' |':|\'1237'&$x'017'&|x'56'&}%n*{:x|\'134579'&$x'147'&|x'2'&}%


问:
Code ladder, Robbers
This is the robbers' thread. The cops' thread goes here.

Write a code that has the same number of bytes as the cop post and where the revealed characters are identical. The code must produce 1 in its initial state, and produce the numbers 2, 3 .. when single alterations are made.

The winner will be the robber that cracked the most posts.

Example post:

MyLang, 9 bytes, 8 numbers (including link to answer), Cop's username.

Original code:

```<code>abc1efghi
</code>```

Code that produces 1 - 8:

```<code>1: abc1efghi
2: abc2efghi
3: abc2efghij
4: kbc2efghij
5: kbc23fghij
6: kbc23fghi
7: kbc63fghi
8: kbc63fhi
</code>```

Explanations are encouraged. The exact format of the robber post is optional.

答:
Befunge-93, 11 bytes, 10 numbers, James Holderness

```<code>"15:**-6-.@
"15:**-6-2.@
"15:**-6-2+.@
"15:**-6-3+.@
...
"15:**-6-9+.@
</code>```

A more complete crack of James' Befunge cop, after Martin's here. Because Befunge-93 has a limited board, the IP actually waits until it gets to the end of the board before wrapping around, unlike other 2D languages such as ><>. This means that a wraparound char push with " ends up pushing the values of the empty cells too, which by default is 32 for space.

Hence here at the start we push a bunch of chars, with 32 on top, then 1:5**- on that gives 32 - (1*(5*5)) = 32 - 25 = 7. Subtract another 6, and we have 1 to start off the ladder.

Title: Code ladder, Robbers

Body:
Befunge-93, 11 bytes, 10 numbers, James Holderness

"15:**-6-.@
"15:**-6-2.@
"15:**-6-2+.@
"15:**-6-3+.@
...
"15:**-6-9+.@

A more complete crack of James' Befunge cop, after Martin's here. Because Befunge-93 has a limited board, the IP actually waits until it gets to the end of the board before wrapping around, unlike other 2D languages such as ><>. This means that a wraparound char push with " ends up pushing the values of the empty cells too, which by default is 32 for space.

Hence here at the start we push a bunch of chars, with 32 on top, then 1:5**- on that gives 32 - (1*(5*5)) = 32 - 25 = 7. Subtract another 6, and we have 1 to start off the ladder.


答:
R, 8 bytes, 10 numbers by Tensibai

Original code:

```<code>_a___+__
</code>```

Modified:

```<code>max(0+1)
max(1+1)
...
max(4+5)
max(5+5)
</code>```

Title: Code ladder, Robbers

Body:
This is the robbers' thread. The cops' thread goes here.

Write a code that has the same number of bytes as the cop post and where the revealed characters are identical. The code must produce 1 in its initial state, and produce the numbers 2, 3 .. when single alterations are made.

The winner will be the robber that cracked the most posts.

Example post:

MyLang, 9 bytes, 8 numbers (including link to answer), Cop's username.

Original code:

```<code>abc1efghi
</code>```

Code that produces 1 - 8:

```<code>1: abc1efghi
2: abc2efghi
3: abc2efghij
4: kbc2efghij
5: kbc23fghij
6: kbc23fghi
7: kbc63fghi
8: kbc63fhi
</code>```

Explanations are encouraged. The exact format of the robber post is optional.

Body:
R, 8 bytes, 10 numbers by Tensibai

Original code:

_a___+__

Modified:

max(0+1)
max(1+1)
...
max(4+5)
max(5+5)


Title: Code ladder, Robbers

Body:
JavaScript (ES6), 63 bytes, 10 numbers by Arnauld

Original code:

eval([...(n=0,"l?0?a?(?x?")].sort(_=>[...????+[]][n++]).join``)

Modified:

eval([...(n=0,"le0ta1(rx)")].sort(_=>[...8/73+[]][n++]).join``)
eval([...(n=0,"le0ta2(rx)")].sort(_=>[...8/73+[]][n++]).join``)
...
eval([...(n=0,"le0ta9(rx)")].sort(_=>[...8/73+[]][n++]).join``)
eval([...(n=0,"le0taa(rx)")].sort(_=>[...8/73+[]][n++]).join``)

This was a lot of fun to get to the bottom of, even though my first approach was off!


问:
Quine Anagrams! (Cops' Thread)
This is the cops' thread. For the robbers' thread, click here.

Cops' Task

First, write a quine in a language of your choosing.

Next, scramble the quine. Make sure to do this well as the robbers will be trying to unscramble it and find the original source code! Note that the scrambled code does not need to work.

Post an answer on this thread. Include the language, the byte count, and the scrambled code.

Your program may not print to STDERR.

Here is an example of a cop submission:

Python, 29 bytes

```<code>nt _%=_r;_riinp;pr_='t _%%%_'
</code>```

Robbers' Task

For the robbers' thread, click here.

Safe Submissions

If your submission has not yet been cracked after a week of posting, you may add the solution and specify that it is safe. If you do not, your submission may still be cracked.

Scoring

This is code-golf, so the user with the safe submission with the fewest bytes will be the winner of this section.

Leaderboard

Here is a stack snippet to generate a learderboard for this challenge. For it to display properly, please format your submission like this:

```<code># Language Name, N bytes

... other stuff ...
</code>```

If your submission gets cracked, please format like this:

```<code># Language Name, N bytes, [Cracked!](link)

... other stuff ...
</code>```

If your submission is safe, format like this:

```<code># Language Name, N bytes, Safe!

... other stuff ...
</code>```

```

答:
Retina, 20 bytes, Cracked

```<code>S`(\?)\1*

S`(\?)\1*
</code>```

The program (and output) contains exactly two linefeeds.

You can try Retina online here.

A small hint:

 In the process of designing this cop, I found a new shortest Retina quine, which I'll post to our quine challenge once this answer is either cracked or safe.

Title: Quine Anagrams! (Cops' Thread)

Body:
Retina, 20 bytes, Cracked

S`(\?)\1*

S`(\?)\1*

The program (and output) contains exactly two linefeeds.

You can try Retina online here.

A small hint:

 In the process of designing this cop, I found a new shortest Retina quine, which I'll post to our quine challenge once this answer is either cracked or safe.


答:
ASMD, 8 bytes, 10 numbers, by Oliver

For 1, 1t-t+++C

For 2, 1t-t+++C{

For 3, 1t-t+++C{{

…

Works with the latest commit at the time of posting. C claims to be implemented, but it isn’t.

Each program works as follows:

```<code>1              Push 1.             1
 t             Triplicate.         1 1 1
  -            Subtract.           1 0
   t           Triplicate.         1 0 0 0
    +          Add.                1 0 0
     +         Add.                1 0
      +        Add.                1
       C       Do nothing.         1
        {{{    Increment n times.  4
</code>```

Title: Code ladder, Robbers

Body:
ASMD, 8 bytes, 10 numbers, by Oliver

For 1, 1t-t+++C

For 2, 1t-t+++C{

For 3, 1t-t+++C{{

…

Works with the latest commit at the time of posting. C claims to be implemented, but it isn’t.

Each program works as follows:

1              Push 1.             1
 t             Triplicate.         1 1 1
  -            Subtract.           1 0
   t           Triplicate.         1 0 0 0
    +          Add.                1 0 0
     +         Add.                1 0
      +        Add.                1
       C       Do nothing.         1
        {{{    Increment n times.  4


问:
North by North by North by South East
Given a string of N, S, E and W, output a bearing (angle clockwise from North in degrees), correct to 5 decimal places.

In traditional compass notation, a string is made up of only 2 of these characters (like NNW or ESE). Here you must also accept strings that contain all 4 (like WNNNSE). Using only 2 symbols allows humans to intuitively understand the meaning. Allowing 4 symbols makes it horrible to read, but allows shorter ways of describing a bearing to a given accuracy.

(As pointed out in the comments by user2357112, it turns out you can prove that for any given bearing, the 4 symbol string will be exactly the same length as the 2 symbol string, so I've based this challenge on a false assumption. Hopefully this lack of a practical purpose doesn't detract from your enjoyment of the challenge...)

The exact method is described below, and is equivalent to the traditional notation (it expands on it rather than changing it).

Input

The input is a single string containing only the characters NESW.

The input may be a sequence of characters if you prefer, provided this does not include any preprocessing. For example, taking a nested list [N, [E, [S, [W]]]] to help with the order of processing is not permitted.

Taking different characters is not permitted. You may not take a string of 1234 instead of NESW.

Output

The output must be a decimal number or string representation of one (not a rational/fraction).

Trailing zeros do not need to be displayed. If the bearing is 9.00000, then the output 9 also counts as correct to 5 decimal places.

The output is in the range [0, 360). That is, including 0 but excluding 360.

Correctness is checked by rounding the output to 5 decimal places. If the bearing is 0.000005, this rounds to 0.00001. Outputs 0.00001 and 0.000005 are both correct.

Output in scientific notation for some inputs is acceptable. For example, 1e-5 instead of 0.00001.

Conversion

The single character compass points N, E, S, and W correspond to 0, 90, 180, and 270 degrees respectively.

Prepending one of these to a string results in the bearing that bisects the bearing of the single character and the bearing of the original string.

The closest of the two possible bisecting bearings is chosen, so that NE represents 45 degrees, not 225 degrees.

This is unambiguous except where the angle to be bisected is 180 degrees. Therefore NS, SN, WE, and EW correspond to undefined bearings, and the input will never end in any of these. They may however appear anywhere else in the input string, as this causes no ambiguity.

If the final two characters are identical, the final character will be redundant as the bisection will return the same bearing. Since this adds nothing to the notation, your code does not need to handle this. Therefore NN, EE, SS, and WW correspond to undefined bearings, and the input will never end in any of these. They may however appear anywhere else in the input string.

Examples

```<code>N: 0
E: 90
S: 180
SE: halfway between S and E: 135
NSE: halfway between N and SE: 67.5
NNSE: halfway between N and NSE: 33.75
NNNSE: halfway between N and NNSE: 16.875
NNNNSE: halfway between N and NNNSE: 8.4375
</code>```

Test cases

A submission is only valid if it gives correct output for all of the test cases. Note that the test cases push to the limits of what can be handled with double precision. For languages that default to single precision, you will probably need to spend the bytes to specify double precision in order to get correct outputs.

Test case outputs are shown rounded to 5 decimal places, and also to arbitrary precision. Both are valid outputs.

```<code>WNE 337.5 337.5
WEN 337.5 337.5
WEWEWEWEWEWEWEWEWEWEWEN 330.00001 330.000007152557373046875
NESWNESWNESWNESWNESWNESWNESW 90 89.99999932944774627685546875
NNNNNNNNNNNNNNNNNNNNNNNE 0.00001 0.0000107288360595703125
NNNNNNNNNNNNNNNNNNNNNNNW 359.99999 359.9999892711639404296875
SNNNNNNNNNNNNNNNNNNNNNNNE 90.00001 90.00000536441802978515625
SNNNNNNNNNNNNNNNNNNNNNNNW 269.99999 269.99999463558197021484375
</code>```

Scoring

This is code-golf. The score is the length of the source code in bytes, and the shortest wins.

Pedantry

 I made the mistake of thinking that "North by North West" was a valid compass direction. A happy mistake, since it led to a challenge idea, but I then discovered from the Wikipedia page:

 "The title of the Alfred Hitchcock 1959 movie, North by Northwest, is actually not a direction point on the 32-wind compass, but the film contains a reference to Northwest Airlines."

 It also turns out that the method used for this challenge is only consistent with traditional compass points up to and including the 16 point compass. The 32-wind compass described on that page is subtly different and I have conveniently overlooked its existence for this challenge.

 Finally, for anyone who thinks I should use "Southeast" instead of "South East", it seems to be a regional difference.

答:
C#6, <s>226</s> <s>217</s> <s>207</s> 185 bytes

using System.Linq;double N(string s){double b=f(s.Last());foreach(var c in s.Reverse()){b=(b+f(c)+(b-f(c)>2?4:f(c)-b>2?-4:0))/2;b=(b+4)%4;}return b*90;}int f(char x)=>"NESW".IndexOf(x);
```

<p>Edit: -10 bytes by "borrowing" idea from ETHproductions's submission<br>
-22 bytes thanks to @Titus</p>

<p>Ungolfed</p>

<pre class="lang-cs prettyprint-override"><code>// Call this method
double N(string s){
    // Initialize bearing with last direction
    double b=f(s.Last());
    // Do backward. Doing last direction once more doesn't impact result
    foreach(var c in s.Reverse()){
        // Average current bearing with new bearing, adjusted with wrapping
        b=(b+f(c)+(b-f(c)>2?4:f(c)-b>2?-4:0))/2;
        // Make bearing back to range [0,4)
        b=(b+4)%4;
    }
    // Change from "full circle = 4" unit to degree
    return b*90;
}
// helper method to convert direction to bearing. This returns bearing with full circle = 4.
int f(char x)=>"NESW".IndexOf(x);
</code>```

Title: North by North by North by South East

Body:
C#6, <s>226</s> <s>217</s> <s>207</s> 185 bytes

using System.Linq;double N(string s){double b=f(s.Last());foreach(var c in s.Reverse()){b=(b+f(c)+(b-f(c)>2?4:f(c)-b>2?-4:0))/2;b=(b+4)%4;}return b*90;}int f(char x)=>"NESW".IndexOf(x);

Edit: -10 bytes by "borrowing" idea from ETHproductions's submission

-22 bytes thanks to @Titus

Ungolfed

// Call this method
double N(string s){
    // Initialize bearing with last direction
    double b=f(s.Last());
    // Do backward. Doing last direction once more doesn't impact result
    foreach(var c in s.Reverse()){
        // Average current bearing with new bearing, adjusted with wrapping
        b=(b+f(c)+(b-f(c)>2?4:f(c)-b>2?-4:0))/2;
        // Make bearing back to range [0,4)
        b=(b+4)%4;
    }
    // Change from "full circle = 4" unit to degree
    return b*90;
}
// helper method to convert direction to bearing. This returns bearing with full circle = 4.
int f(char x)=>"NESW".IndexOf(x);


答:
PHP, <s>95</s> <s>88</s> <s>86</s> <s>100</s> <s>127</s> <s>104</s> 101 bytes

-7 bytes with the null coalescing operator

-2 bytes by not replacing N (and more, because that allows to put the translation to the loop head: N is truthy, but evaluates to 0 in the calculation.)

+41 bytes for fixing the bisection (cough)

-7 bytes directly and -16 indirectly inspired by @ETHproductions´ code

-3 bytes by replacing strtr with one of my bit jugglings

```<code>for($i=strlen($s=$argv[1]);$i--;$p=($q+$p=$p??$q)/2+2*(abs($q-$p)>2))$q=ord($s[$i])/.8+3&3;echo$p*90;
</code>```

This is officially the first time ever that I use the null coalescing operator. Run with -r.

PHP 7.1

Negative string offsets in the upcoming PHP version will save 12 bytes:

Replace strlen($s=$argv[1]) with 0 and $s with $argv[1].

Free bytes for (almost) everyone:

Calculating with 0,1,2,3 instead of 0,90,180,270 and multiplying the final result with 90 will save two bytes and probably allow further golfing.

There are some patterns in the ASCII codes of the characters. Try one of these in your language:

(a/2%6+2)%5

a<87?a/2&3^3:3 or a/2&3^3*(a<87)

a&1?a&2|a/4&1:0

a/.8-1&3

Title: North by North by North by South East

Body:
Given a string of N, S, E and W, output a bearing (angle clockwise from North in degrees), correct to 5 decimal places.

In traditional compass notation, a string is made up of only 2 of these characters (like NNW or ESE). Here you must also accept strings that contain all 4 (like WNNNSE). Using only 2 symbols allows humans to intuitively understand the meaning. Allowing 4 symbols makes it horrible to read, but allows shorter ways of describing a bearing to a given accuracy.

(As pointed out in the comments by user2357112, it turns out you can prove that for any given bearing, the 4 symbol string will be exactly the same length as the 2 symbol string, so I've based this challenge on a false assumption. Hopefully this lack of a practical purpose doesn't detract from your enjoyment of the challenge...)

The exact method is described below, and is equivalent to the traditional notation (it expands on it rather than changing it).

Input

The input is a single string containing only the characters NESW.

The input may be a sequence of characters if you prefer, provided this does not include any preprocessing. For example, taking a nested list [N, [E, [S, [W]]]] to help with the order of processing is not permitted.

Taking different characters is not permitted. You may not take a string of 1234 instead of NESW.

Output

The output must be a decimal number or string representation of one (not a rational/fraction).

Trailing zeros do not need to be displayed. If the bearing is 9.00000, then the output 9 also counts as correct to 5 decimal places.

The output is in the range [0, 360). That is, including 0 but excluding 360.

Correctness is checked by rounding the output to 5 decimal places. If the bearing is 0.000005, this rounds to 0.00001. Outputs 0.00001 and 0.000005 are both correct.

Output in scientific notation for some inputs is acceptable. For example, 1e-5 instead of 0.00001.

Conversion

The single character compass points N, E, S, and W correspond to 0, 90, 180, and 270 degrees respectively.

Prepending one of these to a string results in the bearing that bisects the bearing of the single character and the bearing of the original string.

The closest of the two possible bisecting bearings is chosen, so that NE represents 45 degrees, not 225 degrees.

This is unambiguous except where the angle to be bisected is 180 degrees. Therefore NS, SN, WE, and EW correspond to undefined bearings, and the input will never end in any of these. They may however appear anywhere else in the input string, as this causes no ambiguity.

If the final two characters are identical, the final character will be redundant as the bisection will return the same bearing. Since this adds nothing to the notation, your code does not need to handle this. Therefore NN, EE, SS, and WW correspond to undefined bearings, and the input will never end in any of these. They may however appear anywhere else in the input string.

Examples

```<code>N: 0
E: 90
S: 180
SE: halfway between S and E: 135
NSE: halfway between N and SE: 67.5
NNSE: halfway between N and NSE: 33.75
NNNSE: halfway between N and NNSE: 16.875
NNNNSE: halfway between N and NNNSE: 8.4375
</code>```

Test cases

A submission is only valid if it gives correct output for all of the test cases. Note that the test cases push to the limits of what can be handled with double precision. For languages that default to single precision, you will probably need to spend the bytes to specify double precision in order to get correct outputs.

Test case outputs are shown rounded to 5 decimal places, and also to arbitrary precision. Both are valid outputs.

```<code>WNE 337.5 337.5
WEN 337.5 337.5
WEWEWEWEWEWEWEWEWEWEWEN 330.00001 330.000007152557373046875
NESWNESWNESWNESWNESWNESWNESW 90 89.99999932944774627685546875
NNNNNNNNNNNNNNNNNNNNNNNE 0.00001 0.0000107288360595703125
NNNNNNNNNNNNNNNNNNNNNNNW 359.99999 359.9999892711639404296875
SNNNNNNNNNNNNNNNNNNNNNNNE 90.00001 90.00000536441802978515625
SNNNNNNNNNNNNNNNNNNNNNNNW 269.99999 269.99999463558197021484375
</code>```

Scoring

This is code-golf. The score is the length of the source code in bytes, and the shortest wins.

Pedantry

 I made the mistake of thinking that "North by North West" was a valid compass direction. A happy mistake, since it led to a challenge idea, but I then discovered from the Wikipedia page:

 "The title of the Alfred Hitchcock 1959 movie, North by Northwest, is actually not a direction point on the 32-wind compass, but the film contains a reference to Northwest Airlines."

 It also turns out that the method used for this challenge is only consistent with traditional compass points up to and including the 16 point compass. The 32-wind compass described on that page is subtly different and I have conveniently overlooked its existence for this challenge.

 Finally, for anyone who thinks I should use "Southeast" instead of "South East", it seems to be a regional difference.

Body:
PHP, <s>95</s> <s>88</s> <s>86</s> <s>100</s> <s>127</s> <s>104</s> 101 bytes

-7 bytes with the null coalescing operator

-2 bytes by not replacing N (and more, because that allows to put the translation to the loop head: N is truthy, but evaluates to 0 in the calculation.)

+41 bytes for fixing the bisection (cough)

-7 bytes directly and -16 indirectly inspired by @ETHproductions´ code

-3 bytes by replacing strtr with one of my bit jugglings

for($i=strlen($s=$argv[1]);$i--;$p=($q+$p=$p??$q)/2+2*(abs($q-$p)>2))$q=ord($s[$i])/.8+3&3;echo$p*90;

This is officially the first time ever that I use the null coalescing operator. Run with -r.

PHP 7.1

Negative string offsets in the upcoming PHP version will save 12 bytes:

Replace strlen($s=$argv[1]) with 0 and $s with $argv[1].

Free bytes for (almost) everyone:

Calculating with 0,1,2,3 instead of 0,90,180,270 and multiplying the final result with 90 will save two bytes and probably allow further golfing.

There are some patterns in the ASCII codes of the characters. Try one of these in your language:

(a/2%6+2)%5

a<87?a/2&3^3:3 or a/2&3^3*(a<87)

a&1?a&2|a/4&1:0

a/.8-1&3


答:
Dyalog APL, <s>55</s> <s>45</s> 38 bytes

Solution

Requires ⎕IO←0, which is default on many systems. Asks for direction.

360|÷○÷180×12○(+÷(|+))/¯12○○2÷⍨'NES'⍳⍞
```

<h3>Explanation</h3>

<p>Goes around the problem by converting each letter to a complex number 1∠<em>θ</em> ⇔ <em>a</em> + <em>b · i</em>, then doing a sum reduction from right-to-left (APL's forte) while normalizing at each step. The final <em>θ</em> is then converted to degrees and normalized to be within [0, 360):</p>

<p><code>'NES'⍳⍞</code> the indices of each input letter in "NES"; N→0, E→1, S→2, anything else→3</p>

<p><code>○2÷⍨</code> convert to angles in radians; <em>θ</em> = <em>π</em> · <sup><strong><em>x</em></strong></sup>∕<sub>2</sub></p>

<p><code>¯12○</code> convert to complex numbers on the unit circle; <em>e<sup>i · θ</em></sup></p>

<p><code>(</code>...<code>)/</code> reduce the list with... (i.e. insert the function between the elements of...)</p>

<p> <code>+÷(|+)</code> ... the normalized sum; <sup><strong><em>x</em></strong><sub><em>n</em> - 1</sub> + <strong><em>x</strong><sub>n</em></sub></sup>∕<sub>|<strong><em>x</em></strong><sub><em>n</em> - 1</sub> + <strong><em>x</strong><sub>n</em></sub>|</sub></p>

<p><code>12○</code> convert to angle; <em>θ</em></p>

<p><code>÷○÷180×</code> convert to degrees; <sup>1</sup>∕<sub><em>π</em> · <sup>1</sup>∕<sub>180 · <strong><em>x</em></strong></sub></sub></p>

<p><code>360|</code> division remainder when divided by 360</p>

<p>TryAPL online!</p>

<h3>Anecdote</h3>

<p>If input and output was as orthogonal complex units, the entire solution would be just:</p>

<pre class="lang-apl prettyprint-override"><code>(+÷(|+))/
</code>```

The rest of the code is parsing input and formatting output.

Title: North by North by North by South East

Body:
Dyalog APL, <s>55</s> <s>45</s> 38 bytes

Solution

Requires ⎕IO←0, which is default on many systems. Asks for direction.

360|÷○÷180×12○(+÷(|+))/¯12○○2÷⍨'NES'⍳⍞

Explanation

Goes around the problem by converting each letter to a complex number 1∠θ ⇔ a + b · i, then doing a sum reduction from right-to-left (APL's forte) while normalizing at each step. The final θ is then converted to degrees and normalized to be within [0, 360):

'NES'⍳⍞ the indices of each input letter in "NES"; N→0, E→1, S→2, anything else→3

○2÷⍨ convert to angles in radians; θ = π · x∕2

¯12○ convert to complex numbers on the unit circle; ei · θ

(...)/ reduce the list with... (i.e. insert the function between the elements of...)

 +÷(|+) ... the normalized sum; xn - 1 + xn∕|xn - 1 + xn|

12○ convert to angle; θ

÷○÷180× convert to degrees; 1∕π · 1∕180 · x

360| division remainder when divided by 360

TryAPL online!

Anecdote

If input and output was as orthogonal complex units, the entire solution would be just:

(+÷(|+))/

The rest of the code is parsing input and formatting output.


问:
GO OUT AND VOTE
Today is November 8th, 2016, Election Day in the United States of America.

If you are a U.S. citizen eligible to vote, then go out and vote if you haven't already before answering this challenge. Do not discuss who you voted for. It only matters that you voted.

If you are not a U.S. citizen or not eligible to vote, then, before answering this challenge, do the U.S. a favor by telling anyone you know who is an eligible citizen to go out and vote if they haven't already.

Challenge

Write a program that indicates that you voted, like a digital "I Voted" sticker.

It should take no input and must output in a reasonable way the phrase I Voted where the I, o, and e are red (#FF0000) and the V, t, and d are blue (#0000FF). The background must be white (#FFFFFF).

For example:

These colors are of course representative of the American flag (though not the official colors). Red comes first simply because it comes first in the common idiom "red white and blue".

To be valid, an answer must:

Use the colors specified in the arrangement specified.

Use a single legible font and font size. The example uses 72pt Times New Roman bold but any common font above 6pt is probably fine.

Have just the phrase I Voted on a single line, capitalized correctly, with a clear space between the two words. It shouldn't look like IVoted.

Not indicate who the answerer voted for or supports for president or any down-ballot races. Let's not start any internet debates. This is about celebrating voting, not candidates.

Any reasonable way of displaying or producing the output is valid, such as:

Drawing the text to an image that is then displayed, saved, or output raw.

Writing the text to a console using color formatting. In this case you may approximate pure red and blue if necessary, and it's ok if only the area directly behind the text can be made white.

Displaying the text on a WPF/Windows form.

Outputting an HTML/RTF/PDF file with the text.

Please post an image of your output.

The shortest answer in bytes wins.

答:
Ruby, 85 Bytes

UPDATE: Forgot the white background

```<code>require"colorize";puts ("I".red+"V".blue+"o".red+"t".blue+"e".red+"d".blue).on_white
</code>```

Output:

Title: GO OUT AND VOTE

Body:
Ruby, 85 Bytes

UPDATE: Forgot the white background

require"colorize";puts ("I".red+"V".blue+"o".red+"t".blue+"e".red+"d".blue).on_white

Output:


问:
5 Favorite Letters
The challenge is actually extremely simple. Pick 5 distinct letters (you can just pick the 5 that allow you the shortest code if you like) and output them to the console. However, the twist is that they must be from the following list:

```<code> AAA      BBBB       CCCC     DDDD      EEEEE     FFFFF      GGG      H   H
A   A     B   B     C         D   D     E         F         G         H   H
AAAAA     BBBB      C         D   D     EEEE      FFFF      G  GG     HHHHH
A   A     B   B     C         D   D     E         F         G   G     H   H
A   A     BBBB       CCCC     DDDD      EEEEE     F          GGG      H   H

IIIII         J     K   K     L         M   M     N   N      OOO
  I           J     K  K      L         MM MM     NN  N     O   O
  I           J     KKK       L         M M M     N N N     O   O
  I       J   J     K  K      L         M   M     N  NN     O   O
IIIII      JJJ      K   K     LLLLL     M   M     N   N      OOO

PPPP       QQQ      RRRR       SSSS     TTTTT     U   U     V   V     W   W
P   P     Q   Q     R   R     S           T       U   U     V   V     W   W
PPPP      Q   Q     RRRR       SSS        T       U   U     V   V     W   W
P         Q  QQ     R  R          S       T       U   U      V V      W W W
P          QQQQ     R   R     SSSS        T        UUU        V        W W

X   X     Y   Y     ZZZZZ
 X X       Y Y         Z
  X         Y         Z
 X X        Y        Z
X   X       Y       ZZZZZ
</code>```

Additional Rules:

5 of the same letter is not allowed, no repeat choices.

Each letter must use the capital of itself as the ascii-character to draw it.

Each letter output must be on the "same line" and have 5 spaces between each letter.

You may choose any 5 letters that you want, this will allow you to reuse some code and lower your byte count. Figuring out which letters will allow you to do this most efficiently is part of the challenge.

Trailing spaces are acceptable.

A single trailing newline is acceptable, no more than one trailing newline though.

This is code-golf, lowest byte-count wins.

Examples:

A B C D E

```<code> AAA      BBBB       CCCC     DDDD      EEEEE
A   A     B   B     C         D   D     E
AAAAA     BBBB      C         D   D     EEEE
A   A     B   B     C         D   D     E
A   A     BBBB       CCCC     DDDD      EEEEE
</code>```

E F L I P

```<code>EEEEE     FFFFF     L         IIIII     PPPP
E         F         L           I       P   P
EEEE      FFFF      L           I       PPPP
E         F         L           I       P
EEEEE     F         LLLLL     IIIII     P
</code>```

C R A Z Y

```<code> CCCC     RRRR       AAA      ZZZZZ     Y   Y
C         R   R     A   A        Z       Y Y
C         RRRR      AAAAA       Z         Y
C         R  R      A   A      Z          Y
 CCCC     R   R     A   A     ZZZZZ       Y
</code>```

Don't be afraid to submit more than one answer with different letters or different strategies each time, this can be accomplished various different ways.

答:
PowerShell v2+, <s>138</s> <s>128</s> <s>114</s> <s>112</s> <s>106</s> 105 bytes (LICTD)

```<code>"L1    IIIII1 CCCC1TTTTT1DDDD
$("L11 I1  C11 T1  D   D
"*3)LLLLL1IIIII1 CCCC1  T1  DDDD"-replace1,'     '
</code>```

The idea is to maximize the spaces between the letters so we can get repeated compressions.

Borrows the middle-row deduplication trick from Florent's answer. Saved 6 bytes thanks to Ben Owen by using string multiplication for the middle three rows, and an additional byte thanks to Matt.

Output is like the following at 227 bytes, for a 53.7% reduction --

```<code>PS C:\Tools\Scripts\golfing> .\5-favorite-letters.ps1
L         IIIII      CCCC     TTTTT     DDDD
L           I       C           T       D   D
L           I       C           T       D   D
L           I       C           T       D   D
LLLLL     IIIII      CCCC       T       DDDD
</code>```

Title: 5 Favorite Letters

Body:
PowerShell v2+, <s>138</s> <s>128</s> <s>114</s> <s>112</s> <s>106</s> 105 bytes (LICTD)

"L1    IIIII1 CCCC1TTTTT1DDDD
$("L11 I1  C11 T1  D   D
"*3)LLLLL1IIIII1 CCCC1  T1  DDDD"-replace1,'     '

The idea is to maximize the spaces between the letters so we can get repeated compressions.

Borrows the middle-row deduplication trick from Florent's answer. Saved 6 bytes thanks to Ben Owen by using string multiplication for the middle three rows, and an additional byte thanks to Matt.

Output is like the following at 227 bytes, for a 53.7% reduction --

PS C:\Tools\Scripts\golfing> .\5-favorite-letters.ps1
L         IIIII      CCCC     TTTTT     DDDD
L           I       C           T       D   D
L           I       C           T       D   D
L           I       C           T       D   D
LLLLL     IIIII      CCCC       T       DDDD


Title: North by North by North by South East

Body:
Python 3, <s>146</s> <s>145</s> <s>117</s> <s>107</s> <s>97</s> <s>94</s> <s>93</s> 92 bytes

f(s):u='NESW'.find(s[0])*90;return(u+f(s[1:]))/2+180*(abs(u-f(s[1:]))>180)if s[1:]else u

Call f with the string.


答:
JavaScript, <s>110</s> 109 bytes (CLOUD)

```<code>` CCCC5L9 OOO6U3U5DDDD
${x=`C9L9O3O5U3U5D3D
`,x+x+x} CCCC5LLLLL6OOO7UUU6DDDD`.replace(/\d/g,c=>" ".repeat(c))
</code>```

console.log(
` CCCC5L9 OOO6U3U5DDDD
${x=`C9L9O3O5U3U5D3D
`,x+x+x} CCCC5LLLLL6OOO7UUU6DDDD`.replace(/\d/g,c=>" ".repeat(c))
)```
</div>
</div>
</p>

<p>Output is 227 bytes:</p>

``` CCCC     L          OOO      U   U     DDDD
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
 CCCC     LLLLL      OOO       UUU      DDDD
```

Title: 5 Favorite Letters

Body:
The challenge is actually extremely simple. Pick 5 distinct letters (you can just pick the 5 that allow you the shortest code if you like) and output them to the console. However, the twist is that they must be from the following list:

```<code> AAA      BBBB       CCCC     DDDD      EEEEE     FFFFF      GGG      H   H
A   A     B   B     C         D   D     E         F         G         H   H
AAAAA     BBBB      C         D   D     EEEE      FFFF      G  GG     HHHHH
A   A     B   B     C         D   D     E         F         G   G     H   H
A   A     BBBB       CCCC     DDDD      EEEEE     F          GGG      H   H

IIIII         J     K   K     L         M   M     N   N      OOO
  I           J     K  K      L         MM MM     NN  N     O   O
  I           J     KKK       L         M M M     N N N     O   O
  I       J   J     K  K      L         M   M     N  NN     O   O
IIIII      JJJ      K   K     LLLLL     M   M     N   N      OOO

PPPP       QQQ      RRRR       SSSS     TTTTT     U   U     V   V     W   W
P   P     Q   Q     R   R     S           T       U   U     V   V     W   W
PPPP      Q   Q     RRRR       SSS        T       U   U     V   V     W   W
P         Q  QQ     R  R          S       T       U   U      V V      W W W
P          QQQQ     R   R     SSSS        T        UUU        V        W W

X   X     Y   Y     ZZZZZ
 X X       Y Y         Z
  X         Y         Z
 X X        Y        Z
X   X       Y       ZZZZZ
</code>```

Additional Rules:

5 of the same letter is not allowed, no repeat choices.

Each letter must use the capital of itself as the ascii-character to draw it.

Each letter output must be on the "same line" and have 5 spaces between each letter.

You may choose any 5 letters that you want, this will allow you to reuse some code and lower your byte count. Figuring out which letters will allow you to do this most efficiently is part of the challenge.

Trailing spaces are acceptable.

A single trailing newline is acceptable, no more than one trailing newline though.

This is code-golf, lowest byte-count wins.

Examples:

A B C D E

```<code> AAA      BBBB       CCCC     DDDD      EEEEE
A   A     B   B     C         D   D     E
AAAAA     BBBB      C         D   D     EEEE
A   A     B   B     C         D   D     E
A   A     BBBB       CCCC     DDDD      EEEEE
</code>```

E F L I P

```<code>EEEEE     FFFFF     L         IIIII     PPPP
E         F         L           I       P   P
EEEE      FFFF      L           I       PPPP
E         F         L           I       P
EEEEE     F         LLLLL     IIIII     P
</code>```

C R A Z Y

```<code> CCCC     RRRR       AAA      ZZZZZ     Y   Y
C         R   R     A   A        Z       Y Y
C         RRRR      AAAAA       Z         Y
C         R  R      A   A      Z          Y
 CCCC     R   R     A   A     ZZZZZ       Y
</code>```

Don't be afraid to submit more than one answer with different letters or different strategies each time, this can be accomplished various different ways.

Body:
JavaScript, <s>110</s> 109 bytes (CLOUD)

` CCCC5L9 OOO6U3U5DDDD
${x=`C9L9O3O5U3U5D3D
`,x+x+x} CCCC5LLLLL6OOO7UUU6DDDD`.replace(/\d/g,c=>" ".repeat(c))

console.log(
` CCCC5L9 OOO6U3U5DDDD
${x=`C9L9O3O5U3U5D3D
`,x+x+x} CCCC5LLLLL6OOO7UUU6DDDD`.replace(/\d/g,c=>" ".repeat(c))
)

Output is 227 bytes:

 CCCC     L          OOO      U   U     DDDD
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
 CCCC     LLLLL      OOO       UUU      DDDD


答:
Perl, 31 bytes, 10 numbers, by Gabriel Benamy

Original code:

```<code>__e_$a__<__$_;1 while_$__;say$_
</code>```

Code that produces 1 to 10 (note: these answers each have a leading space that doesn't show up in StackExchange's markdown):

 $e=$a+q<1_$>;1 while!$e ;say$e

 $e=$a+q<1_$>+1 while!$e ;say$e

 $e=$a+q<1_$>+2 while!$e ;say$e

 $e=$a+q<1_$>+3 while!$e ;say$e

 $e=$a+q<1_$>+4 while!$e ;say$e

 $e=$a+q<1_$>+5 while!$e ;say$e

 $e=$a+q<1_$>+6 while!$e ;say$e

 $e=$a+q<1_$>+7 while!$e ;say$e

 $e=$a+q<1_$>+8 while!$e ;say$e

 $e=$a+q<1_$>+9 while!$e ;say$e

I'm genuinely unsure whether you intended something like this and were aiming for misdirection, or whether this solution is completely different from the intended one.

The main trick I used is Perl's ability to get rid of unwanted characters by using a q, thus changing them into custom quotation marks (while allowing me to drop something that looks like 1 as an integer into the string that's actually quoted). It's not a trick that's normally that useful when golfing, because Perl has quote marks that use fewer bytes, but it comes in handy for challenges like this.

Title: Code ladder, Robbers

Body:
Perl, 31 bytes, 10 numbers, by Gabriel Benamy

Original code:

__e_$a__<__$_;1 while_$__;say$_

Code that produces 1 to 10 (note: these answers each have a leading space that doesn't show up in StackExchange's markdown):

 $e=$a+q<1_$>;1 while!$e ;say$e

 $e=$a+q<1_$>+1 while!$e ;say$e

 $e=$a+q<1_$>+2 while!$e ;say$e

 $e=$a+q<1_$>+3 while!$e ;say$e

 $e=$a+q<1_$>+4 while!$e ;say$e

 $e=$a+q<1_$>+5 while!$e ;say$e

 $e=$a+q<1_$>+6 while!$e ;say$e

 $e=$a+q<1_$>+7 while!$e ;say$e

 $e=$a+q<1_$>+8 while!$e ;say$e

 $e=$a+q<1_$>+9 while!$e ;say$e

I'm genuinely unsure whether you intended something like this and were aiming for misdirection, or whether this solution is completely different from the intended one.

The main trick I used is Perl's ability to get rid of unwanted characters by using a q, thus changing them into custom quotation marks (while allowing me to drop something that looks like 1 as an integer into the string that's actually quoted). It's not a trick that's normally that useful when golfing, because Perl has quote marks that use fewer bytes, but it comes in handy for challenges like this.


问:
Code ladder, Cops

Note: This challenge is finished. Submissions are still welcome but can not win.

This is the cops' thread. The robbers' thread goes here.

Write a code that outputs the integer 1. If you add, remove or substitute a single character (of your choosing), the code should output the integer 2. Change one more character (the same or another), and the code should output 3. Continue like this as far as you can, but maximum up to 10. Default output formats such as ans = 1 are accepted. You can ignore output to STDERR (or equivalent).

You must reveal the language, byte count of your initial code, the number of integers it works for, as well as an optional number of characters of the initial code. Note: You don't have to reveal any characters, but remember that revealing characters might make it harder for the robbers as they must use the same character in the same position. You can choose which character you use to denote unrevealed characters (for instance underscore), but make sure to specify this.

Cops can provide the uncracked code after one week and call the submission "SAFE". The winning submission will be the shortest uncracked submission that produces the number 10. If no uncracked submissions are able to print 10, the shortest code that produces 9 will win, and so on. Note that the robbers don't have to make the same changes as you do, and they don't have to reproduce the exact code (unless you reveal all characters). They must only reproduce the output.

Submissions posted later than November 24th are welcome but not eligible for the win (because there will likely be fewer robbers around).

Example post:

The following post is a submission in the language MyLang, it is 9 bytes long, and it works for numbers 1 - 8.

MyLang, 9 bytes, 8 numbers

This submission works for 1 - 8. Unrevealed characters are indicated with an underscore: _.

```<code>abc____i
</code>```

Leaderboard

Disclaimer: The leaderboard is not tested and uncracked submissions might not appear in the list.

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/Sites/codegolf/all.css?v=7509797c03ea">

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

答:
Perl, 26 bytes, 10 numbers Cracked by ais523 and Sunny Pun

```<code>____;@a=($_..10);say$a[__]
</code>```

I'm almost positive there's an alternate solution to this problem, but let's see if anyone else can find it because I haven't been able to see it.

Edit: It looks like two people managed to circumvent what I was trying to do!

ais523's solution:

```<code>____;@a=($|..10);say$a[+1]  #Prints 1
____;@a=($|..10);say$a[1+1] #Prints 2
...
____;@a=($|..10);say$a[9+1] #Prints 10
</code>```

Sunny Pun's solution:

```<code>$_=0;@a=($_..10);say$a[+1]  #Prints 1
...
$_=9;@a=($_..10);say$a[+1]  #Prints 10
</code>```

Intended solution:

```<code>$[=1;@a=($[..10);say$a[$[]  #Prints 1
$[=2;@a=($[..10);say$a[$[]  #Prints 2
$[=3;@a=($[..10);say$a[$[]  #Prints 3
$[=4;@a=($[..10);say$a[$[]  #Prints 4
$[=5;@a=($[..10);say$a[$[]  #Prints 5
$[=5;@a=($[..10);say$a[-$[]  #Prints 6
$[=4;@a=($[..10);say$a[-$[]  #Prints 7
$[=3;@a=($[..10);say$a[-$[]  #Prints 8
$[=2;@a=($[..10);say$a[-$[]  #Prints 9
$[=1;@a=($[..10);say$a[-$[]  #Prints 10
</code>```

While deprecated, $[ still allows you to modify the indexing of arrays (typically, 0-based).  It prints a warning to STDERR, but OP says that any output to STDERR can be ignored.

Title: Code ladder, Cops

Body:
Perl, 26 bytes, 10 numbers Cracked by ais523 and Sunny Pun

____;@a=($_..10);say$a[__]

I'm almost positive there's an alternate solution to this problem, but let's see if anyone else can find it because I haven't been able to see it.

Edit: It looks like two people managed to circumvent what I was trying to do!

ais523's solution:

____;@a=($|..10);say$a[+1]  #Prints 1
____;@a=($|..10);say$a[1+1] #Prints 2
...
____;@a=($|..10);say$a[9+1] #Prints 10

Sunny Pun's solution:

$_=0;@a=($_..10);say$a[+1]  #Prints 1
...
$_=9;@a=($_..10);say$a[+1]  #Prints 10

Intended solution:

$[=1;@a=($[..10);say$a[$[]  #Prints 1
$[=2;@a=($[..10);say$a[$[]  #Prints 2
$[=3;@a=($[..10);say$a[$[]  #Prints 3
$[=4;@a=($[..10);say$a[$[]  #Prints 4
$[=5;@a=($[..10);say$a[$[]  #Prints 5
$[=5;@a=($[..10);say$a[-$[]  #Prints 6
$[=4;@a=($[..10);say$a[-$[]  #Prints 7
$[=3;@a=($[..10);say$a[-$[]  #Prints 8
$[=2;@a=($[..10);say$a[-$[]  #Prints 9
$[=1;@a=($[..10);say$a[-$[]  #Prints 10

While deprecated, $[ still allows you to modify the indexing of arrays (typically, 0-based).  It prints a warning to STDERR, but OP says that any output to STDERR can be ignored.


答:
Ruby, <s>110</s> <s>107</s> 102 bytes (DOCIL)

```<code>puts a=?D*4+(t=' '*7)+?O*3+t+?C*4+(s=' '*5)+?I*5+s+?L,['D   D'+s+'O   O'+s+?C+' '*11+?I+t+?L]*3,a+?L*4
</code>```

Prints

```<code>DDDD       OOO       CCCC     IIIII     L
D   D     O   O     C           I       L
D   D     O   O     C           I       L
D   D     O   O     C           I       L
DDDD       OOO       CCCC     IIIII     LLLLL
</code>```

EDIT: Saved some chars by avoiding join and moving things around

Title: 5 Favorite Letters

Body:
Ruby, <s>110</s> <s>107</s> 102 bytes (DOCIL)

puts a=?D*4+(t=' '*7)+?O*3+t+?C*4+(s=' '*5)+?I*5+s+?L,['D   D'+s+'O   O'+s+?C+' '*11+?I+t+?L]*3,a+?L*4

Prints

DDDD       OOO       CCCC     IIIII     L
D   D     O   O     C           I       L
D   D     O   O     C           I       L
D   D     O   O     C           I       L
DDDD       OOO       CCCC     IIIII     LLLLL

EDIT: Saved some chars by avoiding join and moving things around


答:
Python 3, <s>234</s> <s>228</s> <s>227</s> 166 bytes (CLOUD):

```<code>import base64,gzip;b=b'ABzY86gn$d0{>HR1_A{T@KJyRe}8`nBNU1i6kLFS%Nec$q1YdaQ51tPO;sx(oDBkK&Q=Hwg(wC)8vxUXJX_-c000';print(gzip.decompress(base64.b85decode(b)).decode())
</code>```

Prints:

```<code> CCCC     L          OOO      U   U     DDDD
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
 CCCC     LLLLL      OOO       UUU      DDDD
</code>```

Title: 5 Favorite Letters

Body:
Python 3, <s>234</s> <s>228</s> <s>227</s> 166 bytes (CLOUD):

import base64,gzip;b=b'ABzY86gn$d0{>HR1_A{T@KJyRe}8`nBNU1i6kLFS%Nec$q1YdaQ51tPO;sx(oDBkK&Q=Hwg(wC)8vxUXJX_-c000';print(gzip.decompress(base64.b85decode(b)).decode())

Prints:

 CCCC     L          OOO      U   U     DDDD
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
C         L         O   O     U   U     D   D
 CCCC     LLLLL      OOO       UUU      DDDD


答:
C, 184 bytes

double h(char c){return ((c=='E')+(c=='S')*2+(c=='W')*3);}double d(char*s){double f=h(*s);if(s[1]){double t=f;f=(f+d(s+1)/90)/2;if(((t-f)>1)||((f-t)>1))f+=2;if(f>=4)f-=4;}return f*90;}
```
<p><strong>Ungolfed</strong></p>
<pre class="lang-c prettyprint-override"><code>// a helper function
double direction_(char ch)
{
    if (ch=='N')
        return 0.;
    else if (ch=='E')
        return 90.;
    else if (ch=='S')
        return 180.;
    else
        return 270.;
}

// this is the main function to call
double direction(char* str)
{
    double fAngle = direction_(str[0]);
    if (str[1])
    {
        double tmp = fAngle + direction(str+1);
        if (tmp>=360.)
            tmp-=360.;
        tmp/=2;

        if (((tmp-fAngle)>90.) || ((tmp-fAngle)<-90.))
        { //  check if we need to take the "other side"; if the resulting angle is more than 90 degrees away, we took the wrong on
            if (tmp>=180.)
                tmp-=180.;
            else
                tmp+=180.;
        }
        fAngle = tmp;
    }
    return fAngle;
}
</code>```

Title: North by North by North by South East

Body:
C, 184 bytes

double h(char c){return ((c=='E')+(c=='S')*2+(c=='W')*3);}double d(char*s){double f=h(*s);if(s[1]){double t=f;f=(f+d(s+1)/90)/2;if(((t-f)>1)||((f-t)>1))f+=2;if(f>=4)f-=4;}return f*90;}

Ungolfed

// a helper function
double direction_(char ch)
{
    if (ch=='N')
        return 0.;
    else if (ch=='E')
        return 90.;
    else if (ch=='S')
        return 180.;
    else
        return 270.;
}

// this is the main function to call
double direction(char* str)
{
    double fAngle = direction_(str[0]);
    if (str[1])
    {
        double tmp = fAngle + direction(str+1);
        if (tmp>=360.)
            tmp-=360.;
        tmp/=2;

        if (((tmp-fAngle)>90.) || ((tmp-fAngle)<-90.))
        { //  check if we need to take the "other side"; if the resulting angle is more than 90 degrees away, we took the wrong on
            if (tmp>=180.)
                tmp-=180.;
            else
                tmp+=180.;
        }
        fAngle = tmp;
    }
    return fAngle;
}


答:
Common Lisp, <s>347</s> 327 bytes

Thanks to @Titus for taking off a few

This can probably be golfed more, but at least it works (I think):

```<code>(defun d(c)(if(eql c #\N)0(if(eql c #\E)1(if(eql c #\S)2(if(eql c #\W)3)))))(defun m(a b)(if(> a b)(rotatef a b))(if(<(+(- 4 b)a)(- b a))(+(/(+(- 4 b)a)2)b)(+(/(- b a)2)a)))(defun f(s)(let((c))(setf c(d(char s(1-(length s)))))(do((a)(p(-(length s)2)(1- p)))((< p 0))(setf a(char s p))(setf c(m(d a)c)))(format t"~5$"(* c 90))))
</code>```

Usage:

```<code>* (f "WNE")
337.50000
NIL
</code>```

Function d takes a character N, E, W, or S and returns the appropriate degree. Function m gets the approprate combined degree of two given directions. Function f iterates through the provided string, computes the appropriate degree, and prints it as a floating point.

Title: North by North by North by South East

Body:
Common Lisp, <s>347</s> 327 bytes

Thanks to @Titus for taking off a few

This can probably be golfed more, but at least it works (I think):

(defun d(c)(if(eql c #\N)0(if(eql c #\E)1(if(eql c #\S)2(if(eql c #\W)3)))))(defun m(a b)(if(> a b)(rotatef a b))(if(<(+(- 4 b)a)(- b a))(+(/(+(- 4 b)a)2)b)(+(/(- b a)2)a)))(defun f(s)(let((c))(setf c(d(char s(1-(length s)))))(do((a)(p(-(length s)2)(1- p)))((< p 0))(setf a(char s p))(setf c(m(d a)c)))(format t"~5$"(* c 90))))

Usage:

* (f "WNE")
337.50000
NIL

Function d takes a character N, E, W, or S and returns the appropriate degree. Function m gets the approprate combined degree of two given directions. Function f iterates through the provided string, computes the appropriate degree, and prints it as a floating point.


答:
ES6 (Javascript), 194, 181 bytes (IGOLF/ANY)

This one is long, and is not really optimized (not yet at least), but can be modified to print any particular message, by only changing the bitmap data.

EDIT: Replaced inner reduce with map, use bit shift for padding

Golfed

```<code>[0x1f73a1f,0x484610,0x49c61e,0x48c610,0x1f73bf0].map(r=>[0,1,2,3,4].map(p=>('0000'+(r>>(20-p*5)<<5).toString(2)).substr(-10).replace(/(1|0)/g,b=>' IGOLF'[(p+1)*b])).join``).join`\n`
</code>```

Demo

```<code>[0x1f73a1f,0x484610,0x49c61e,0x48c610,0x1f73bf0].map(r=>[0,1,2,3,4].map(p=>('0000'+(r>>(20-p*5)<<5).toString(2)).substr(-10).replace(/(1|0)/g,b=>' IGOLF'[(p+1)*b])).join``).join`\n`

IIIII      GGG       OOO      L         FFFFF
  I       G         O   O     L         F
  I       G  GG     O   O     L         FFFF
  I       G   G     O   O     L         F
IIIII      GGG       OOO      LLLLL     F
</code>```

Theory

Take a letter:

```<code>IIIII
  I
  I
  I
IIIII
</code>```

convert it to binary matrix (bitmap)

```<code>11111
00100
00100
00100
11111
</code>```

do the same for other 4 letters, scan a line, by taking "top" 5 bits off each

11111 01110 01110 10000 11111

convert to a hexadecimal string (should be using base36 or even printable ASCII here)

0x1f73a1f

apply the same algorithm to other 4 lines, to get the bitmap.

Render in the reverse order.

Title: 5 Favorite Letters

Body:
ES6 (Javascript), 194, 181 bytes (IGOLF/ANY)

This one is long, and is not really optimized (not yet at least), but can be modified to print any particular message, by only changing the bitmap data.

EDIT: Replaced inner reduce with map, use bit shift for padding

Golfed

[0x1f73a1f,0x484610,0x49c61e,0x48c610,0x1f73bf0].map(r=>[0,1,2,3,4].map(p=>('0000'+(r>>(20-p*5)<<5).toString(2)).substr(-10).replace(/(1|0)/g,b=>' IGOLF'[(p+1)*b])).join``).join`\n`

Demo

[0x1f73a1f,0x484610,0x49c61e,0x48c610,0x1f73bf0].map(r=>[0,1,2,3,4].map(p=>('0000'+(r>>(20-p*5)<<5).toString(2)).substr(-10).replace(/(1|0)/g,b=>' IGOLF'[(p+1)*b])).join``).join`\n`

IIIII      GGG       OOO      L         FFFFF
  I       G         O   O     L         F
  I       G  GG     O   O     L         FFFF
  I       G   G     O   O     L         F
IIIII      GGG       OOO      LLLLL     F

Theory

Take a letter:

IIIII
  I
  I
  I
IIIII

convert it to binary matrix (bitmap)

11111
00100
00100
00100
11111

do the same for other 4 letters, scan a line, by taking "top" 5 bits off each

11111 01110 01110 10000 11111

convert to a hexadecimal string (should be using base36 or even printable ASCII here)

0x1f73a1f

apply the same algorithm to other 4 lines, to get the bitmap.

Render in the reverse order.


答:
Perl, 31 bytes, 10 numbers Cracked by ais523

```<code>__e_$a__<__$_;1 while_$a_;say$_
</code>```

My original post was cracked with a solution that wasn't even in the realm of what I was going for, so I'm adding a single extra byte that renders the previous solution (hopefully) unsalvageable.

Once again cracked in a way I haven't accounted for:

```<code>the;$a+=<1\$>;1 while!$a ;say$a #Prints 1
the;$a+=<1\$>+1 while!$a ;say$a #Prints 2
...
the;$a+=<1\$>+9 while!$a ;say$a #Prints 10
</code>```

Title: Code ladder, Cops

Body:
Note: This challenge is finished. Submissions are still welcome but can not win.

This is the cops' thread. The robbers' thread goes here.

Write a code that outputs the integer 1. If you add, remove or substitute a single character (of your choosing), the code should output the integer 2. Change one more character (the same or another), and the code should output 3. Continue like this as far as you can, but maximum up to 10. Default output formats such as ans = 1 are accepted. You can ignore output to STDERR (or equivalent).

You must reveal the language, byte count of your initial code, the number of integers it works for, as well as an optional number of characters of the initial code. Note: You don't have to reveal any characters, but remember that revealing characters might make it harder for the robbers as they must use the same character in the same position. You can choose which character you use to denote unrevealed characters (for instance underscore), but make sure to specify this.

Cops can provide the uncracked code after one week and call the submission "SAFE". The winning submission will be the shortest uncracked submission that produces the number 10. If no uncracked submissions are able to print 10, the shortest code that produces 9 will win, and so on. Note that the robbers don't have to make the same changes as you do, and they don't have to reproduce the exact code (unless you reveal all characters). They must only reproduce the output.

Submissions posted later than November 24th are welcome but not eligible for the win (because there will likely be fewer robbers around).

Example post:

The following post is a submission in the language MyLang, it is 9 bytes long, and it works for numbers 1 - 8.

MyLang, 9 bytes, 8 numbers

This submission works for 1 - 8. Unrevealed characters are indicated with an underscore: _.

```<code>abc____i
</code>```

Leaderboard

Disclaimer: The leaderboard is not tested and uncracked submissions might not appear in the list.

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/Sites/codegolf/all.css?v=7509797c03ea">

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Body:
Perl, 31 bytes, 10 numbers Cracked by ais523

__e_$a__<__$_;1 while_$a_;say$_

My original post was cracked with a solution that wasn't even in the realm of what I was going for, so I'm adding a single extra byte that renders the previous solution (hopefully) unsalvageable.

Once again cracked in a way I haven't accounted for:

the;$a+=<1\$>;1 while!$a ;say$a #Prints 1
the;$a+=<1\$>+1 while!$a ;say$a #Prints 2
...
the;$a+=<1\$>+9 while!$a ;say$a #Prints 10


答:
JavaScript ES6, 168 bytes, CHAMP

We can stop looking guys, we have a CHAMP over here

f=_=>
` C3cHaHdA2dMaMcP3
CgHaHcAaAcMM MMcPaP
CgH4cA4cM M McP3
CgHaHcAaAcMaMcP
 C3cHaHcAaAcMaMcP`.replace(/[a-z\d]/g,(a,i,c)=>+a?c[i-1].repeat(a):' '.repeat(parseInt(a,36)-7))

a.innerHTML = f()```
<pre class="snippet-code-html lang-html prettyprint-override"><code><pre id=a></code>```

Title: 5 Favorite Letters

Body:
JavaScript ES6, 168 bytes, CHAMP

We can stop looking guys, we have a CHAMP over here

f=_=>
` C3cHaHdA2dMaMcP3
CgHaHcAaAcMM MMcPaP
CgH4cA4cM M McP3
CgHaHcAaAcMaMcP
 C3cHaHcAaAcMaMcP`.replace(/[a-z\d]/g,(a,i,c)=>+a?c[i-1].repeat(a):' '.repeat(parseInt(a,36)-7))

a.innerHTML = f()

<pre id=a>


答:
JavaScript (ES6), <s>84</s> <s>80</s> <s>78</s> <s>74</s> 72 bytes

Saved a byte thanks to @Titus, 1 thanks to @Neil

f=([c,...s],b="NESW".search(c))=>b*90-(s[0]?(b-=f(s)/90)-4*(b*b>4):0)*45
```

<p>It took a while, but I think I've finally perfected the formula...</p>

<h3>Test snippet</h3>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>f=([c,...s],b="NESW".search(c))=>b*90-(s[0]?(b-=f(s)/90)-4*(b*b>4):0)*45
g=(s,n)=>console.log('f("'+s+'"):',f(s),"expected:",n)

g("N", 0)
g("NE", 45)
g("E", 90)
g("SE", 135)
g("S", 180)
g("SW", 225)
g("W", 270)
g("NW", 315)
g("WNE", 337.5)
g("WEN", 337.5)
g("WEWEWEWEWEWEWEWEWEWEWEN", 330.00001)
g("NESWNESWNESWNESWNESWNESWNESWNESWNESWNESWNESWNESWNESW", 90)
g("NNNNNNNNNNNNNNNNNNNNNNNE", 0.00001)
g("NNNNNNNNNNNNNNNNNNNNNNNW", 359.99999)
g("SNNNNNNNNNNNNNNNNNNNNNNNE", 90.00001)
g("SNNNNNNNNNNNNNNNNNNNNNNNW", 269.99999)</code>```

Explanation

Let's start with the simplest case: a single-char string. The result is simply its (0-indexed) position in the string NESW, multiplied by 90.

For a two-char string, the result lies halfway between the result of the first char and the result of the second. However, there's a catch: if the absolute difference between the two is greater than 180 (e.g. NW or WN), we must 180 to the angle so that it's not pointing the opposite direction.

For any longer string, the result lies halfway between the result of the first char and the result of the rest of the string. This can be generalized in the following way:

If the input is a single char, return its index in the string NESW times 90.

Otherwise, return the index of the first char in the string NESW times 45, plus half the result of the rest of the string; add an extra 180 if the absolute difference between the two is greater than 90.

Title: North by North by North by South East

Body:
Given a string of N, S, E and W, output a bearing (angle clockwise from North in degrees), correct to 5 decimal places.

In traditional compass notation, a string is made up of only 2 of these characters (like NNW or ESE). Here you must also accept strings that contain all 4 (like WNNNSE). Using only 2 symbols allows humans to intuitively understand the meaning. Allowing 4 symbols makes it horrible to read, but allows shorter ways of describing a bearing to a given accuracy.

(As pointed out in the comments by user2357112, it turns out you can prove that for any given bearing, the 4 symbol string will be exactly the same length as the 2 symbol string, so I've based this challenge on a false assumption. Hopefully this lack of a practical purpose doesn't detract from your enjoyment of the challenge...)

The exact method is described below, and is equivalent to the traditional notation (it expands on it rather than changing it).

Input

The input is a single string containing only the characters NESW.

The input may be a sequence of characters if you prefer, provided this does not include any preprocessing. For example, taking a nested list [N, [E, [S, [W]]]] to help with the order of processing is not permitted.

Taking different characters is not permitted. You may not take a string of 1234 instead of NESW.

Output

The output must be a decimal number or string representation of one (not a rational/fraction).

Trailing zeros do not need to be displayed. If the bearing is 9.00000, then the output 9 also counts as correct to 5 decimal places.

The output is in the range [0, 360). That is, including 0 but excluding 360.

Correctness is checked by rounding the output to 5 decimal places. If the bearing is 0.000005, this rounds to 0.00001. Outputs 0.00001 and 0.000005 are both correct.

Output in scientific notation for some inputs is acceptable. For example, 1e-5 instead of 0.00001.

Conversion

The single character compass points N, E, S, and W correspond to 0, 90, 180, and 270 degrees respectively.

Prepending one of these to a string results in the bearing that bisects the bearing of the single character and the bearing of the original string.

The closest of the two possible bisecting bearings is chosen, so that NE represents 45 degrees, not 225 degrees.

This is unambiguous except where the angle to be bisected is 180 degrees. Therefore NS, SN, WE, and EW correspond to undefined bearings, and the input will never end in any of these. They may however appear anywhere else in the input string, as this causes no ambiguity.

If the final two characters are identical, the final character will be redundant as the bisection will return the same bearing. Since this adds nothing to the notation, your code does not need to handle this. Therefore NN, EE, SS, and WW correspond to undefined bearings, and the input will never end in any of these. They may however appear anywhere else in the input string.

Examples

```<code>N: 0
E: 90
S: 180
SE: halfway between S and E: 135
NSE: halfway between N and SE: 67.5
NNSE: halfway between N and NSE: 33.75
NNNSE: halfway between N and NNSE: 16.875
NNNNSE: halfway between N and NNNSE: 8.4375
</code>```

Test cases

A submission is only valid if it gives correct output for all of the test cases. Note that the test cases push to the limits of what can be handled with double precision. For languages that default to single precision, you will probably need to spend the bytes to specify double precision in order to get correct outputs.

Test case outputs are shown rounded to 5 decimal places, and also to arbitrary precision. Both are valid outputs.

```<code>WNE 337.5 337.5
WEN 337.5 337.5
WEWEWEWEWEWEWEWEWEWEWEN 330.00001 330.000007152557373046875
NESWNESWNESWNESWNESWNESWNESW 90 89.99999932944774627685546875
NNNNNNNNNNNNNNNNNNNNNNNE 0.00001 0.0000107288360595703125
NNNNNNNNNNNNNNNNNNNNNNNW 359.99999 359.9999892711639404296875
SNNNNNNNNNNNNNNNNNNNNNNNE 90.00001 90.00000536441802978515625
SNNNNNNNNNNNNNNNNNNNNNNNW 269.99999 269.99999463558197021484375
</code>```

Scoring

This is code-golf. The score is the length of the source code in bytes, and the shortest wins.

Pedantry

 I made the mistake of thinking that "North by North West" was a valid compass direction. A happy mistake, since it led to a challenge idea, but I then discovered from the Wikipedia page:

 "The title of the Alfred Hitchcock 1959 movie, North by Northwest, is actually not a direction point on the 32-wind compass, but the film contains a reference to Northwest Airlines."

 It also turns out that the method used for this challenge is only consistent with traditional compass points up to and including the 16 point compass. The 32-wind compass described on that page is subtly different and I have conveniently overlooked its existence for this challenge.

 Finally, for anyone who thinks I should use "Southeast" instead of "South East", it seems to be a regional difference.

Body:
JavaScript (ES6), <s>84</s> <s>80</s> <s>78</s> <s>74</s> 72 bytes

Saved a byte thanks to @Titus, 1 thanks to @Neil

f=([c,...s],b="NESW".search(c))=>b*90-(s[0]?(b-=f(s)/90)-4*(b*b>4):0)*45

It took a while, but I think I've finally perfected the formula...

Test snippet

f=([c,...s],b="NESW".search(c))=>b*90-(s[0]?(b-=f(s)/90)-4*(b*b>4):0)*45
g=(s,n)=>console.log('f("'+s+'"):',f(s),"expected:",n)

g("N", 0)
g("NE", 45)
g("E", 90)
g("SE", 135)
g("S", 180)
g("SW", 225)
g("W", 270)
g("NW", 315)
g("WNE", 337.5)
g("WEN", 337.5)
g("WEWEWEWEWEWEWEWEWEWEWEN", 330.00001)
g("NESWNESWNESWNESWNESWNESWNESWNESWNESWNESWNESWNESWNESW", 90)
g("NNNNNNNNNNNNNNNNNNNNNNNE", 0.00001)
g("NNNNNNNNNNNNNNNNNNNNNNNW", 359.99999)
g("SNNNNNNNNNNNNNNNNNNNNNNNE", 90.00001)
g("SNNNNNNNNNNNNNNNNNNNNNNNW", 269.99999)

Explanation

Let's start with the simplest case: a single-char string. The result is simply its (0-indexed) position in the string NESW, multiplied by 90.

For a two-char string, the result lies halfway between the result of the first char and the result of the second. However, there's a catch: if the absolute difference between the two is greater than 180 (e.g. NW or WN), we must 180 to the angle so that it's not pointing the opposite direction.

For any longer string, the result lies halfway between the result of the first char and the result of the rest of the string. This can be generalized in the following way:

If the input is a single char, return its index in the string NESW times 90.

Otherwise, return the index of the first char in the string NESW times 45, plus half the result of the rest of the string; add an extra 180 if the absolute difference between the two is greater than 90.


答:
dc, 69 bytes

This takes input from top of stack, and leaves a result on top of stack.  The result is the count of symmetric difference between the digit sets, so zero indicates true, and other numbers indicate false.

d[O~1r:ad0<f]dsfx+3^[O~1r:bd0<f]dsfxsaO[1-ddd;ar;b-d*la+sad0<m]dsmxla
```

<h2>Explanation</h2>

<p>Expanded version as commented full program with I/O to standard streams:</p>

<pre class="lang-dc prettyprint-override"><code>#!/usr/bin/dc

# read input
?

# store 1 in a[i] for each digit i
d[O~
  1r:a
  d0<f]dsfx
# cube the original number
+3^
# record its digits in b[]
[O~
 1r:b
 d0<f]dsfx

# 0 left on stack used to initialize accumulator
sa
# for i in 9..0, add (b[i]-a[i])^2
# accumulate in register 'a'
O[1-d
  dd;ar;b-d*
  la+sa
  d0<m]dsmx

# load result from accumulator
la

# print output
p
</code>```

I hoped I could re-use the first function to store to both a[] and b[] but I couldn't find an easy way to do it.  Arrays can't be pushed or popped, and it was too hard to add an indirection to the function.

Test results

Here's the test cases from the question, plus those suggested in comments:

0 -> 0
1 -> 0
10 -> 0
107624 -> 0
251894 -> 0
251895 -> 4
102343 -> 6
106239 -> 1
2103869 -> 0
```

<p>And here's the first 50 terms of A029795, of 536 that I identified with this program by testing the numbers up to ten million:</p>

<pre class="lang-none prettyprint-override"><code>0
1
10
100
1000
10000
100000
107624
109573
132485
138624
159406
165640
192574
205738
215806
251894
281536
318725
419375
427863
568314
642510
713960
953867
954086
963218
965760
1000000
1008529
1023479
1023674
1026258
1028537
1028565
1028756
1032284
1035743
1037689
1039725
1045573
1046783
1062851
1062854
1063279
1063724
1066254
1072399
1073824
1076240
</code>```

Body:
Given a number n (0 <= n <= 2642245), check if n and n3 have the same set of digits, and output a truthy or falsey value accordingly.

For example, let's check the number 100.

1003 is 1000000.

The set of digits in 100 is {0, 1}.

The set of digits in 1000000 is {0, 1}.

Therefore, 100 should give a truthy value.

Test cases

```<code>0 -> True
1 -> True
10 -> True
107624 -> True
251894 -> True
251895 -> False
102343 -> False
</code>```

Remember, this is code-golf, so the code with the fewest bytes wins.

OEIS A029795

Body:
dc, 69 bytes

This takes input from top of stack, and leaves a result on top of stack.  The result is the count of symmetric difference between the digit sets, so zero indicates true, and other numbers indicate false.

d[O~1r:ad0<f]dsfx+3^[O~1r:bd0<f]dsfxsaO[1-ddd;ar;b-d*la+sad0<m]dsmxla

Explanation

Expanded version as commented full program with I/O to standard streams:

#!/usr/bin/dc

# read input
?

# store 1 in a[i] for each digit i
d[O~
  1r:a
  d0<f]dsfx
# cube the original number
+3^
# record its digits in b[]
[O~
 1r:b
 d0<f]dsfx

# 0 left on stack used to initialize accumulator
sa
# for i in 9..0, add (b[i]-a[i])^2
# accumulate in register 'a'
O[1-d
  dd;ar;b-d*
  la+sa
  d0<m]dsmx

# load result from accumulator
la

# print output
p

I hoped I could re-use the first function to store to both a[] and b[] but I couldn't find an easy way to do it.  Arrays can't be pushed or popped, and it was too hard to add an indirection to the function.

Test results

Here's the test cases from the question, plus those suggested in comments:

0 -> 0
1 -> 0
10 -> 0
107624 -> 0
251894 -> 0
251895 -> 4
102343 -> 6
106239 -> 1
2103869 -> 0

And here's the first 50 terms of A029795, of 536 that I identified with this program by testing the numbers up to ten million:

0
1
10
100
1000
10000
100000
107624
109573
132485
138624
159406
165640
192574
205738
215806
251894
281536
318725
419375
427863
568314
642510
713960
953867
954086
963218
965760
1000000
1008529
1023479
1023674
1026258
1028537
1028565
1028756
1032284
1035743
1037689
1039725
1045573
1046783
1062851
1062854
1063279
1063724
1066254
1072399
1073824
1076240


答:
Perl, 31 bytes, 10 numbers, by Gabriel Benamy

Original code:

```<code>__e_$a__<__$_;1 while_$a_;say$_
</code>```

Cracked:

the;$a+=<1\$>;1 while!$a ;say$a

the;$a+=<1\$>+1 while!$a ;say$a

the;$a+=<1\$>+2 while!$a ;say$a

the;$a+=<1\$>+3 while!$a ;say$a

the;$a+=<1\$>+4 while!$a ;say$a

the;$a+=<1\$>+5 while!$a ;say$a

the;$a+=<1\$>+6 while!$a ;say$a

the;$a+=<1\$>+7 while!$a ;say$a

the;$a+=<1\$>+8 while!$a ;say$a

the;$a+=<1\$>+9 while!$a ;say$a

The principle using q<> I used last time doesn't seem to quite work here, so I used one of the intended uses of <> brackets (if a fairly obscure one) to create the string 1$ via globbing. Using += rather than = for the assignment to $a converts it to an integer, thus just 1, and then the solution continues the same way as my previous crack.

Fun fact: random sequences of letters in void context (such as the) are no-ops in Perl if they don't happen to spell a keyword.

Title: Code ladder, Robbers

Body:
This is the robbers' thread. The cops' thread goes here.

Write a code that has the same number of bytes as the cop post and where the revealed characters are identical. The code must produce 1 in its initial state, and produce the numbers 2, 3 .. when single alterations are made.

The winner will be the robber that cracked the most posts.

Example post:

MyLang, 9 bytes, 8 numbers (including link to answer), Cop's username.

Original code:

```<code>abc1efghi
</code>```

Code that produces 1 - 8:

```<code>1: abc1efghi
2: abc2efghi
3: abc2efghij
4: kbc2efghij
5: kbc23fghij
6: kbc23fghi
7: kbc63fghi
8: kbc63fhi
</code>```

Explanations are encouraged. The exact format of the robber post is optional.

Body:
Perl, 31 bytes, 10 numbers, by Gabriel Benamy

Original code:

__e_$a__<__$_;1 while_$a_;say$_

Cracked:

the;$a+=<1\$>;1 while!$a ;say$a

the;$a+=<1\$>+1 while!$a ;say$a

the;$a+=<1\$>+2 while!$a ;say$a

the;$a+=<1\$>+3 while!$a ;say$a

the;$a+=<1\$>+4 while!$a ;say$a

the;$a+=<1\$>+5 while!$a ;say$a

the;$a+=<1\$>+6 while!$a ;say$a

the;$a+=<1\$>+7 while!$a ;say$a

the;$a+=<1\$>+8 while!$a ;say$a

the;$a+=<1\$>+9 while!$a ;say$a

The principle using q<> I used last time doesn't seem to quite work here, so I used one of the intended uses of <> brackets (if a fairly obscure one) to create the string 1$ via globbing. Using += rather than = for the assignment to $a converts it to an integer, thus just 1, and then the solution continues the same way as my previous crack.

Fun fact: random sequences of letters in void context (such as the) are no-ops in Perl if they don't happen to spell a keyword.


答:
Perl 5 -p, 82 bytes (DOCIL)

Using the same letters and strategy everyone else is using (reusing the lines where possible), combined with an RLE decoder.

}{$_=($;="4D7 3O7 4C5 5I5 L")."
D3 D5 O3 O5 C11 I7 L"x3 ."
$;4L";s/\d+(.)/$1x$&/ge
```
<p>Try it online!</p>
<hr />
<h1>Perl 5 <code>-p</code>, 95 bytes (ABCDE)</h1>
<p>Contains unprintables, so the link includes them in <code>\x##</code> notation. Verification for 95 bytes.</p>

<pre class="lang-perl prettyprint-override"><code>}{$_=unpack B125,"w...0.?.G..#....";s;.;($&?(A..E)["@-"/5%5]:$").("@+"%25?$"x5x!("@+"%5):$/);ge
</code>```

Try it online!

Explanation

The main data is stored as a binary matrix in the 16 byte string passed to unpack, which is called to convert to binary. Then s/// is called to replace each character with either $" (space) or if $& is falsy (0) or (A..E)["@-"/5%5] otherwise, where "@-" is the start index of the current character (@- is a list so $-[0] would return the first element, but interpolating into a string is 1 byte shorter) and we divide it by 5 and then take that result modulo 5 resulting in 0-4 (as the decimal part is ignored in list indices) based on the position, this correctly gets the letters in the right place for each of the larger letters. This is then appended to with, if "@+"%25 (like "@-" above, but @+ contains the end index of the current match) is truthy, $"x5x!("@+"%5) (space repeated [x] five times, repeated once when "@+"%5 is false) which adds the required spaces after each letter, or $/ (newline) otherwise.

Title: 5 Favorite Letters

Body:
The challenge is actually extremely simple. Pick 5 distinct letters (you can just pick the 5 that allow you the shortest code if you like) and output them to the console. However, the twist is that they must be from the following list:

```<code> AAA      BBBB       CCCC     DDDD      EEEEE     FFFFF      GGG      H   H
A   A     B   B     C         D   D     E         F         G         H   H
AAAAA     BBBB      C         D   D     EEEE      FFFF      G  GG     HHHHH
A   A     B   B     C         D   D     E         F         G   G     H   H
A   A     BBBB       CCCC     DDDD      EEEEE     F          GGG      H   H

IIIII         J     K   K     L         M   M     N   N      OOO
  I           J     K  K      L         MM MM     NN  N     O   O
  I           J     KKK       L         M M M     N N N     O   O
  I       J   J     K  K      L         M   M     N  NN     O   O
IIIII      JJJ      K   K     LLLLL     M   M     N   N      OOO

PPPP       QQQ      RRRR       SSSS     TTTTT     U   U     V   V     W   W
P   P     Q   Q     R   R     S           T       U   U     V   V     W   W
PPPP      Q   Q     RRRR       SSS        T       U   U     V   V     W   W
P         Q  QQ     R  R          S       T       U   U      V V      W W W
P          QQQQ     R   R     SSSS        T        UUU        V        W W

X   X     Y   Y     ZZZZZ
 X X       Y Y         Z
  X         Y         Z
 X X        Y        Z
X   X       Y       ZZZZZ
</code>```

Additional Rules:

5 of the same letter is not allowed, no repeat choices.

Each letter must use the capital of itself as the ascii-character to draw it.

Each letter output must be on the "same line" and have 5 spaces between each letter.

You may choose any 5 letters that you want, this will allow you to reuse some code and lower your byte count. Figuring out which letters will allow you to do this most efficiently is part of the challenge.

Trailing spaces are acceptable.

A single trailing newline is acceptable, no more than one trailing newline though.

This is code-golf, lowest byte-count wins.

Examples:

A B C D E

```<code> AAA      BBBB       CCCC     DDDD      EEEEE
A   A     B   B     C         D   D     E
AAAAA     BBBB      C         D   D     EEEE
A   A     B   B     C         D   D     E
A   A     BBBB       CCCC     DDDD      EEEEE
</code>```

E F L I P

```<code>EEEEE     FFFFF     L         IIIII     PPPP
E         F         L           I       P   P
EEEE      FFFF      L           I       PPPP
E         F         L           I       P
EEEEE     F         LLLLL     IIIII     P
</code>```

C R A Z Y

```<code> CCCC     RRRR       AAA      ZZZZZ     Y   Y
C         R   R     A   A        Z       Y Y
C         RRRR      AAAAA       Z         Y
C         R  R      A   A      Z          Y
 CCCC     R   R     A   A     ZZZZZ       Y
</code>```

Don't be afraid to submit more than one answer with different letters or different strategies each time, this can be accomplished various different ways.

Body:
Perl 5 -p, 82 bytes (DOCIL)

Using the same letters and strategy everyone else is using (reusing the lines where possible), combined with an RLE decoder.

}{$_=($;="4D7 3O7 4C5 5I5 L")."
D3 D5 O3 O5 C11 I7 L"x3 ."
$;4L";s/\d+(.)/$1x$&/ge

Try it online!

Perl 5 -p, 95 bytes (ABCDE)

Contains unprintables, so the link includes them in \x## notation. <a href="https://tio.run/##dZBRT8IwFIXf@RXHOQxEV7bb3rWwKGhi/BHGGLa1QiSwwBAS9bdjmxHf6MPJTXv7nXNvOd8tTqfjsUayhVium30r2uUGD@DEzb8222Vrk5VtW7vdiWZV9A4VkurSo60Wm06RrPGDxm5XSJoL7adTej4T6FqXIMUOstaM3OoUeZZL5CWlUCQzSJIM/H7H7/f7dTOvPvGUEfc6QuYZVBFB67GDdVUOmZoK0lkDpesMpiKJ1LgxcBcdhBCpmIoXIa6FODPIM5x1BkSyhJZeyAYxpEC5dL5Smb8jCwgRFbtCFIP4Zjp4/GdIz1BMY3Dpw6iUak8jPxUTe@Each5o5FvwPHyNZkk04j6/TeJoeGaoMIulkEOloAAiluS/hwgqDGn8KrShzOcYRLPbqE88jaMjH6/ODA4M00Uog11w956duwtVmWvkfqNAh@DhJB4Niw/7Bw" rel="nofollow noreferrer">Verification for 95 bytes.

}{$_=unpack B125,"w...0.?.G..#....";s;.;($&?(A..E)["@-"/5%5]:$").("@+"%25?$"x5x!("@+"%5):$/);ge

Try it online!

Explanation

The main data is stored as a binary matrix in the 16 byte string passed to unpack, which is called to convert to binary. Then s/// is called to replace each character with either $" (space) or if $& is falsy (0) or (A..E)["@-"/5%5] otherwise, where "@-" is the start index of the current character (@- is a list so $-[0] would return the first element, but interpolating into a string is 1 byte shorter) and we divide it by 5 and then take that result modulo 5 resulting in 0-4 (as the decimal part is ignored in list indices) based on the position, this correctly gets the letters in the right place for each of the larger letters. This is then appended to with, if "@+"%25 (like "@-" above, but @+ contains the end index of the current match) is truthy, $"x5x!("@+"%5) (space repeated [x] five times, repeated once when "@+"%5 is false) which adds the required spaces after each letter, or $/ (newline) otherwise.


答:
Perl, 26 bytes, 10 numbers by Gabriel Benamy

Original code:

```<code>____;@a=($_..10);say$a[__]
</code>```

Cracked:

```<code>$_=0;@a=($_..10);say$a[+1]
$_=1;@a=($_..10);say$a[+1]
$_=2;@a=($_..10);say$a[+1]
$_=3;@a=($_..10);say$a[+1]
$_=4;@a=($_..10);say$a[+1]
$_=5;@a=($_..10);say$a[+1]
$_=6;@a=($_..10);say$a[+1]
$_=7;@a=($_..10);say$a[+1]
$_=8;@a=($_..10);say$a[+1]
$_=9;@a=($_..10);say$a[+1]
</code>```

In fact I tested this on my Mac using print instead of say with perl -e... However I do think they should work basically the same.

This is incrementing the "base" of the array and say the second element of the array.  Replacing _s by other characters should work too.

Title: Code ladder, Robbers

Body:
Perl, 26 bytes, 10 numbers by Gabriel Benamy

Original code:

____;@a=($_..10);say$a[__]

Cracked:

$_=0;@a=($_..10);say$a[+1]
$_=1;@a=($_..10);say$a[+1]
$_=2;@a=($_..10);say$a[+1]
$_=3;@a=($_..10);say$a[+1]
$_=4;@a=($_..10);say$a[+1]
$_=5;@a=($_..10);say$a[+1]
$_=6;@a=($_..10);say$a[+1]
$_=7;@a=($_..10);say$a[+1]
$_=8;@a=($_..10);say$a[+1]
$_=9;@a=($_..10);say$a[+1]

In fact I tested this on my Mac using print instead of say with perl -e... However I do think they should work basically the same.

This is incrementing the "base" of the array and say the second element of the array.  Replacing _s by other characters should work too.


答:
Perl, 26 bytes, 10 numbers, by Gabriel Benamy

Original code:

```<code>____;@a=($_..10);say$a[__]
</code>```

Cracked:

____;@a=($|..10);say$a[+1]

____;@a=($|..10);say$a[1+1]

____;@a=($|..10);say$a[2+1]

____;@a=($|..10);say$a[3+1]

____;@a=($|..10);say$a[4+1]

____;@a=($|..10);say$a[5+1]

____;@a=($|..10);say$a[6+1]

____;@a=($|..10);say$a[7+1]

____;@a=($|..10);say$a[8+1]

____;@a=($|..10);say$a[9+1]

I didn't even need the blanks at the start (and as ____ is a legal but pointless Perl statement, I left them as is). The only subtlety here is finding a variable that starts at 0, but there are plenty to choose from; I chose $|.

Title: Code ladder, Robbers

Body:
Perl, 26 bytes, 10 numbers, by Gabriel Benamy

Original code:

____;@a=($_..10);say$a[__]

Cracked:

____;@a=($|..10);say$a[+1]

____;@a=($|..10);say$a[1+1]

____;@a=($|..10);say$a[2+1]

____;@a=($|..10);say$a[3+1]

____;@a=($|..10);say$a[4+1]

____;@a=($|..10);say$a[5+1]

____;@a=($|..10);say$a[6+1]

____;@a=($|..10);say$a[7+1]

____;@a=($|..10);say$a[8+1]

____;@a=($|..10);say$a[9+1]

I didn't even need the blanks at the start (and as ____ is a legal but pointless Perl statement, I left them as is). The only subtlety here is finding a variable that starts at 0, but there are plenty to choose from; I chose $|.


答:
Jelly, <s> 41 </s> 40 bytes

N.B. I have a 39 byte answer too.

LICTE

```<code>141D+“ȷɓSɠ’“ðƁ ƥ“JrŀṘ’jḃ11“LICTE”K¤żⱮŒṙY
</code>```

TryItOnline!

Idea

Use a run length decode with letters that have as similar middle as possible with only one run length of each "pixel value" per row per letter.

Put a flat start like "L" to avoid different run length decode values for the rows.

Place the one different letter (could not find 5) of the three middle rows at the end so the smallest difference may be added arithmetically.

Output wanted; the run lengths; and these converted from base 11:

```<code>                                                  L,  , I,  , C,  , T,  , E   value
                                                  -------------------------
L         IIIII      CCCC     TTTTT     EEEEE     1, 9, 5, 6, 4, 5, 5, 5, 5   399633415
L           I       C           T       E         1,11, 1, 7, 1,11, 1, 7, 1   431646160+1
L           I       C           T       EEEE      1,11, 1, 7, 1,11, 1, 7, 4   431646160+4
L           I       C           T       E         1,11, 1, 7, 1,11, 1, 7, 1   431646160+1
LLLLL     IIIII      CCCC       T       EEEEE     5, 5, 5, 6, 4, 7, 1, 7, 5   1179122455
</code>```

The three values 399633415, 431646160, and 1179122455 in base 250 as Jelly code page indices are then ðƁ ƥ, ȷɓSɠ, and JrŀṘ which can be used to encapsulate the run-length information.

The code

```<code>141D+“ȷɓSɠ’“ðƁ ƥ“JrŀṘ’jḃ11“LICTE”K¤żⱮŒṙY - Main link
141D                                     - 141 as a decimal list: [1, 4, 1]
     “ȷɓSɠ’                              - 431646160
    +                                    - add: [431646161, 431646164, 431646161]
           “ðƁ ƥ“JrŀṘ’                   - list [399633415,1179122455]
                      j                  - join: [399633415, 431646161, 431646164, 431646161, 1179122455]
                       ḃ11               - convert to bijective base 11: [[1, 9, 5, 6, 4, 5, 5, 5, 5], [1, 11, 1, 7, 1, 11, 1, 7, 1], [1, 11, 1, 7, 1, 11, 1, 7, 4], [1, 11, 1, 7, 1, 11, 1, 7, 1], [5, 5, 5, 6, 4, 7, 1, 7, 5]]
                                  ¤      - nilad followed by link(s) as a nilad:
                          “LICTE”        -   list of characters "LICTE"
                                 K       -   join with spaces   "L I C T E"
                                    Ɱ    - map across (the lists of numbers) applying:
                                   ż     -   zip             e.g. [['L',1],[' ',9],['I',5],[' ',6],['C',4],[' ',5],['T',5],[' ',5],['E',5]]
                                     Œṙ  - run-length decode e.g. "L         IIIII      CCCC     TTTTT     EEEEE"
                                       Y - join with line feeds
</code>```

Title: 5 Favorite Letters

Body:
Jelly, <s> 41 </s> 40 bytes

N.B. I have a 39 byte answer too.

LICTE

141D+“ȷɓSɠ’“ðƁ ƥ“JrŀṘ’jḃ11“LICTE”K¤żⱮŒṙY

TryItOnline!

Idea

Use a run length decode with letters that have as similar middle as possible with only one run length of each "pixel value" per row per letter.

Put a flat start like "L" to avoid different run length decode values for the rows.

Place the one different letter (could not find 5) of the three middle rows at the end so the smallest difference may be added arithmetically.

Output wanted; the run lengths; and these converted from base 11:

                                                  L,  , I,  , C,  , T,  , E   value
                                                  -------------------------
L         IIIII      CCCC     TTTTT     EEEEE     1, 9, 5, 6, 4, 5, 5, 5, 5   399633415
L           I       C           T       E         1,11, 1, 7, 1,11, 1, 7, 1   431646160+1
L           I       C           T       EEEE      1,11, 1, 7, 1,11, 1, 7, 4   431646160+4
L           I       C           T       E         1,11, 1, 7, 1,11, 1, 7, 1   431646160+1
LLLLL     IIIII      CCCC       T       EEEEE     5, 5, 5, 6, 4, 7, 1, 7, 5   1179122455

The three values 399633415, 431646160, and 1179122455 in base 250 as Jelly code page indices are then ðƁ ƥ, ȷɓSɠ, and JrŀṘ which can be used to encapsulate the run-length information.

The code

141D+“ȷɓSɠ’“ðƁ ƥ“JrŀṘ’jḃ11“LICTE”K¤żⱮŒṙY - Main link
141D                                     - 141 as a decimal list: [1, 4, 1]
     “ȷɓSɠ’                              - 431646160
    +                                    - add: [431646161, 431646164, 431646161]
           “ðƁ ƥ“JrŀṘ’                   - list [399633415,1179122455]
                      j                  - join: [399633415, 431646161, 431646164, 431646161, 1179122455]
                       ḃ11               - convert to bijective base 11: [[1, 9, 5, 6, 4, 5, 5, 5, 5], [1, 11, 1, 7, 1, 11, 1, 7, 1], [1, 11, 1, 7, 1, 11, 1, 7, 4], [1, 11, 1, 7, 1, 11, 1, 7, 1], [5, 5, 5, 6, 4, 7, 1, 7, 5]]
                                  ¤      - nilad followed by link(s) as a nilad:
                          “LICTE”        -   list of characters "LICTE"
                                 K       -   join with spaces   "L I C T E"
                                    Ɱ    - map across (the lists of numbers) applying:
                                   ż     -   zip             e.g. [['L',1],[' ',9],['I',5],[' ',6],['C',4],[' ',5],['T',5],[' ',5],['E',5]]
                                     Œṙ  - run-length decode e.g. "L         IIIII      CCCC     TTTTT     EEEEE"
                                       Y - join with line feeds


答:
R, 172 146 bytes

```<code>z=rev((0:3*90)[match(scan(,""),c("N","E","S","W"))]);p=z[1];l=length(z);for(i in 2:l)p=(p+z[i])/2+(abs(p-z[i])>180)*180;if(l<2)p=z;sprintf("%f",p)
</code>```

Ungolfed

```<code>z=rev((0:3*90)[match(scan,""),c("N","E","S","W"))]); #1
p=z[1];                                              #2
l=length(z)                                          #3
for(i in 2:l)p=(p+z[i])/2+(abs(p-z[i])>180)*180;     #4
if(l<2)p=z                                           #5
sprintf("%f",p)                                      #6
</code>```

Explained

Read input from stdin

Match input by index to c("N","E","S","W")

From matched indices: match to the vector of degrees 0:3*90 (instead of c(0,90,180,270))

Reverse and store as z

Initialize p to the degree equivalent to last char in input

Store length of input as l

Iteratively, calculate the closest of the two possible bisecting bearings.

If only one input is given, set p to z

Format and print

Try the test cases on R-fiddle
(note that this is a function due to scan not working on R-fiddle)

Title: North by North by North by South East

Body:
R, 172 146 bytes

z=rev((0:3*90)[match(scan(,""),c("N","E","S","W"))]);p=z[1];l=length(z);for(i in 2:l)p=(p+z[i])/2+(abs(p-z[i])>180)*180;if(l<2)p=z;sprintf("%f",p)

Ungolfed

z=rev((0:3*90)[match(scan,""),c("N","E","S","W"))]); #1
p=z[1];                                              #2
l=length(z)                                          #3
for(i in 2:l)p=(p+z[i])/2+(abs(p-z[i])>180)*180;     #4
if(l<2)p=z                                           #5
sprintf("%f",p)                                      #6

Explained

Read input from stdin

Match input by index to c("N","E","S","W")

From matched indices: match to the vector of degrees 0:3*90 (instead of c(0,90,180,270))

Reverse and store as z

Initialize p to the degree equivalent to last char in input

Store length of input as l

Iteratively, calculate the closest of the two possible bisecting bearings.

If only one input is given, set p to z

Format and print

Try the test cases on R-fiddle
(note that this is a function due to scan not working on R-fiddle)