答:
J, accuracy = 50022668/108 = 50.0227%, 4 bytes

```<code>2|*.
</code>```

Takes the coordinates as two arguments, computes the LCM between them and takes it modulo 2. A 0 means it is even and a 1 means it is odd.

The performance is based on the parity bits provided by @Peter Taylor.

The PRNG version before for 7 bytes, 2|?.@#. had an accuracy of 50010491/108.

Explanation

```<code>2|*.  Input: x on LHS, y on RHS
  *.  LCM(x, y)
2|    Modulo 2
</code>```

Title: Print a specific value in the Wythoff matrix modulo 2

Body:
The Wythoff matrix is an infinite matrix consisting of the Grundy numbers of each square on a chessboard in Wythoff's game.

Each entry in this matrix is equal to the smallest nonnegative number that does not appear anywhere above, to the left, or diagonally northwest of the position of the entry.

The top-left 20-by-20 square looks like this:

```<code>  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19
  1  2  0  4  5  3  7  8  6 10 11  9 13 14 12 16 17 15 19 20
  2  0  1  5  3  4  8  6  7 11  9 10 14 12 13 17 15 16 20 18
  3  4  5  6  2  0  1  9 10 12  8  7 15 11 16 18 14 13 21 17
  4  5  3  2  7  6  9  0  1  8 13 12 11 16 15 10 19 18 17 14
  5  3  4  0  6  8 10  1  2  7 12 14  9 15 17 13 18 11 16 21
  6  7  8  1  9 10  3  4  5 13  0  2 16 17 18 12 20 14 15 11
  7  8  6  9  0  1  4  5  3 14 15 13 17  2 10 19 21 12 22 16
  8  6  7 10  1  2  5  3  4 15 16 17 18  0  9 14 12 19 23 24
  9 10 11 12  8  7 13 14 15 16 17  6 19  5  1  0  2  3  4 22
 10 11  9  8 13 12  0 15 16 17 14 18  7  6  2  3  1  4  5 23
 11  9 10  7 12 14  2 13 17  6 18 15  8 19 20 21  4  5  0  1
 12 13 14 15 11  9 16 17 18 19  7  8 10 20 21 22  6 23  3  5
 13 14 12 11 16 15 17  2  0  5  6 19 20  9  7  8 10 22 24  4
 14 12 13 16 15 17 18 10  9  1  2 20 21  7 11 23 22  8 25 26
 15 16 17 18 10 13 12 19 14  0  3 21 22  8 23 20  9 24  7 27
 16 17 15 14 19 18 20 21 12  2  1  4  6 10 22  9 13 25 11 28
 17 15 16 13 18 11 14 12 19  3  4  5 23 22  8 24 25 21 26 10
 18 19 20 21 17 16 15 22 23  4  5  0  3 24 25  7 11 26 12 13
 19 20 18 17 14 21 11 16 24 22 23  1  5  4 26 27 28 10 13 25
</code>```

There is currently no known efficient algorithm for computing an arbitrary entry in the Wythoff matrix. However, your task in this problem is to try to design a heuristic function that will tell whether the number at a specific coordinate wythoff(x, y) is even or odd.

Your program may not contain more than 64 KB (65,536 bytes) of source code, or use more than 2 MB (2,097,152 bytes) of working memory.

In particular for memory usage, this means that the maximum resident set size of your program may not exceed 2 MB more than the maximum resident set size of an empty program in that language. In the case of an interpreted language, it would be the memory usage of the interpreter / virtual machine itself, and in the case of a compiled language, it would be the memory usage of a program that executes the main method and does nothing.

Your program will be tested on the 10000 x 10000 matrix for row values in 20000 <= x <= 29999 and column values in 20000 <= y <= 29999.

The score of your program is the accuracy rate (number of correct guesses) your program achieves, with shorter code acting as a tiebreaker.

Body:
J, accuracy = 50022668/108 = 50.0227%, 4 bytes

2|*.

Takes the coordinates as two arguments, computes the LCM between them and takes it modulo 2. A 0 means it is even and a 1 means it is odd.

The performance is based on the parity bits provided by @Peter Taylor.

The PRNG version before for 7 bytes, 2|?.@#. had an accuracy of 50010491/108.

Explanation

2|*.  Input: x on LHS, y on RHS
  *.  LCM(x, y)
2|    Modulo 2


问:
KITT car ASCII art
The 80's TV series Knight Rider featured an intelligent, self-aware car called KITT. One distinctive aspect of the car was a front-mounted scanner bar that allowed KITT to "see" (and that looked suspiciously familiar to fans of another, earlier TV series).

The scanner had eight lights as seen in this picture:

The lights "moved" as shown in this animated image.

Your task, as you have guessed by now, it to recreate the scanner bar with the moving lights in ASCII art.

The challenge

Given an integer t, output the state of the scanner bar at that instant, defined as follows:

The scanner consists of eight lights.

At any instant one of the lights is active, and is shown as #. The lights that were active at times t-1 and t-2 are now dimmed, and are shown as +; unless they coincide with the current active one. The rest of the lights are off, and are shown as -.

The active light moves left to right, then right to left.

The exact output for each t is detailed below.

```<code>0  -->  #++-----   % The leftmost light is active, and it just came from the right.
                   % The two neighbouring lights are dimmed
1  -->  +#------   % The active light has bounced to the right, and it is covering
                   % one of the two lights that should be dimmed. So there is only
                   % one dimmed light
2  -->  ++#-----   % The active light has moved one more step to the right, and the
                   % two trailing dimmed lights are visible
3  -->  -++#----
7  -->  -----++#
8  -->  ------#+   % The active light has bounced to the left
9  -->  -----#++
10 -->  ----#++-
13 -->  -#++----
14 -->  #++-----   % Same as 0
15 -->  +#------   % Same as 1
</code>```

For negative values of t the cycle is simply extended:

```<code>-1 -->  -#++----   % Same as 13
-2 -->  --#++---   % Same as 12
</code>```

#Additional rules

You can write a program or function.

Output can contain trailing whitespace and a leading newline.

Shortest code in bytes wins.

答:
Python, 53 bytes

lambda n:('-'*5+'++#'+'-'*6)[-n%7:][:8][::-n/7%2*2-1]
```

Creates the string -----++#------, takes a length-8 window depending on the input modulo 7, reverses for inputs modulo 14 that lie between 1 and 7 .

ContentLicense: CC BY-SA 4.0

Title: KITT car ASCII art

Body:
Python, 53 bytes

lambda n:('-'*5+'++#'+'-'*6)[-n%7:][:8][::-n/7%2*2-1]

Creates the string -----++#------, takes a length-8 window depending on the input modulo 7, reverses for inputs modulo 14 that lie between 1 and 7 .

ContentLicense: CC BY-SA 3.0


问:
Print this tic-tac-toe board!
Here is a tic-tac-toe board:

```<code>   a     b     c
      |     |
1  -  |  -  |  -
 _____|_____|_____
      |     |
2  -  |  -  |  -
 _____|_____|_____
      |     |
3  -  |  -  |  -
      |     |
</code>```

Given a set of moves, print the board with the tokens on.

Input will be taken in as moves separated by spaces, with each move being:

First, the token that's going

Next, the letter of the column it is moving on

Last, the number of the row it is moving on

Note that normal tic-tac-toe rules don't matter.

Also, there is no need to print the letters and numbers.

For example, the input Ob2 Xc2 Ob3 Xa1 would result in

```<code>     |     |
  X  |  -  |  -
_____|_____|_____
     |     |
  -  |  O  |  X
_____|_____|_____
     |     |
  -  |  O  |  -
     |     |
</code>```

Remember, this is code-golf, so the code with the smallest number of bytes wins.

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

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

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code># Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code># Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the leaderboard snippet:

```<code># [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

var QUESTION_ID=95629,OVERRIDE_USER=12537;function answersUrl(e){return"https://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"https://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

```

答:
Java, 138 bytes

Edit:

-2 bytes off. Thanks to @Kevin Kruijssen

Snipet:

```<code>m->{char[][]o=new char[3][3];for(char[]a:m)o[a[1]-'a'][a[2]-'0']=a[0];for(char[]a:o)System.out.println(a[0]+'|'+a[1]+'|'+a[2]+"\n-----");}
</code>```

Code:

```<code>public static void tictactoe(char[][]moves){
  char[][]o=new char[3][3];
  for(char[]a:moves){
    o[a[1]-79][a[2]-48]=a[0];
  }
  for(char[]a:o){
    System.out.println(a[0]+'|'+a[1]+'|'+a[2]+"\n-----");
  }
}
</code>```

Title: Print this tic-tac-toe board!

Body:
Java, 138 bytes

Edit:

-2 bytes off. Thanks to @Kevin Kruijssen

Snipet:

m->{char[][]o=new char[3][3];for(char[]a:m)o[a[1]-'a'][a[2]-'0']=a[0];for(char[]a:o)System.out.println(a[0]+'|'+a[1]+'|'+a[2]+"\n-----");}

Code:

public static void tictactoe(char[][]moves){
  char[][]o=new char[3][3];
  for(char[]a:moves){
    o[a[1]-79][a[2]-48]=a[0];
  }
  for(char[]a:o){
    System.out.println(a[0]+'|'+a[1]+'|'+a[2]+"\n-----");
  }
}


问:
Super Folding Numbers
We have already defined a folding number here.

But now we are going to define a Super Folding Number.  A Super Folding number is a number that if folded enough times it will eventually reach one less than a power of two.  The method of folding is slightly different than in the folding number question.

The folding algorithm goes as follows:

Take the binary representation

e.g. 5882

```<code>1011011111010
</code>```

Spilt it into three partitions.  First half, last half and middle digit (iff it has a odd number of digits)

```<code>101101 1 111010
</code>```

If the middle digit is zero this number cannot be folded

Reverse the second half and superimposed on the first half

```<code>010111
101101
</code>```

Add the digits in place

```<code>111212
</code>```

Iff there are any 2s in the result the number cannot be folded otherwise the new number is the result of the folding algorithm.

A number is a Super Folding number if it can be folded to a continuous string of ones. (All Folding numbers are also Super Folding Numbers)

Your task is to write code that takes in a number and outputs a truthy value if the number is a Super Folding number and falsy otherwise.  You will be scored on the size of your program.

Examples

5200

Convert to binary:

```<code>1010001010000
</code>```

Split in half:

```<code>101000 1 010000
</code>```

The middle is one so we continue
Superimpose the halves:

```<code>000010
101000
</code>```

Added them:

```<code>101010
</code>```

No twos so we continue
Split in half:

```<code>101 010
</code>```

Fold:

```<code>010
101

111
</code>```

The result is 111 (7 in decimal) so this is a Super Folding Number.

Test Cases

The first 100 Super Folding Numbers are:

```<code>101101 1 111010
</code>```0

答:
Python 2, 151 bytes

f=lambda n,r=0:f(bin(n)[2:],'')if r<''else(r==''and{'1'}==set(n)or(n in'1'and f(r,'')+2)or n!='0'and'11'!=n[0]+n[-1]and f(n[1:-1],r+max(n[0],n[-1])))%2
```

ideone

A doubly-recursive function which takes an integer, n, and returns 0 or 1.

A variable r is maintained to allow both the result of folding and to know if we currently: have an integer (first only); have a new binary string to try to fold (outer); or are folding (inner).

On the first pass n is and integer, which is <'' in Python 2 so the recursion starts by casting to a binary string.

The next execution has r='' and so the test {'1'}==set(n) is executed to check for a continuous string of 1s (the RHS cannot be {n} as we may need to pass this point later with r='' and an empty n when that would be a dictionary which wont equal {'1'}, a set).

If this is not satisfied the inner tail criteria is tested for (even if unnecessary): if n in'1' will evaluate to True when n is an empty string or a single 1, whereupon a new outer recursion is begun by placing r, by the then folded, binary string into n and '' into r. The literal 2 is added to the result of this function call to allow no fall through to the next part (to the right of a logical or) that is corrected later.

If that is not a truthy value (all non-zero integers are truthy in Python) the outer tail recursion criteria is tested for: n!=0 excludes the case with a middle 0 and the outer two characters are tested they do not sum to 2 by the string concatenation '11'!=n[0]+n[-1]; if these both hold true the outer bits are discarded from n with n[1:-1], and then a 1 is appended to r if there is one on the outside otherwise a 0 is, using the fact that '1'>'0' in Python with max(n[0],n[-1]).

Finally the addition of 2 at each inner recursion is corrected with %2.

Title: Super Folding Numbers

Body:
Python 2, 151 bytes

f=lambda n,r=0:f(bin(n)[2:],'')if r<''else(r==''and{'1'}==set(n)or(n in'1'and f(r,'')+2)or n!='0'and'11'!=n[0]+n[-1]and f(n[1:-1],r+max(n[0],n[-1])))%2

ideone

A doubly-recursive function which takes an integer, n, and returns 0 or 1.

A variable r is maintained to allow both the result of folding and to know if we currently: have an integer (first only); have a new binary string to try to fold (outer); or are folding (inner).

On the first pass n is and integer, which is <'' in Python 2 so the recursion starts by casting to a binary string.

The next execution has r='' and so the test {'1'}==set(n) is executed to check for a continuous string of 1s (the RHS cannot be {n} as we may need to pass this point later with r='' and an empty n when that would be a dictionary which wont equal {'1'}, a set).

If this is not satisfied the inner tail criteria is tested for (even if unnecessary): if n in'1' will evaluate to True when n is an empty string or a single 1, whereupon a new outer recursion is begun by placing r, by the then folded, binary string into n and '' into r. The literal 2 is added to the result of this function call to allow no fall through to the next part (to the right of a logical or) that is corrected later.

If that is not a truthy value (all non-zero integers are truthy in Python) the outer tail recursion criteria is tested for: n!=0 excludes the case with a middle 0 and the outer two characters are tested they do not sum to 2 by the string concatenation '11'!=n[0]+n[-1]; if these both hold true the outer bits are discarded from n with n[1:-1], and then a 1 is appended to r if there is one on the outside otherwise a 0 is, using the fact that '1'>'0' in Python with max(n[0],n[-1]).

Finally the addition of 2 at each inner recursion is corrected with %2.


问:
Interpret /// (pronounced 'slashes')
Because we can't get enough of esoteric language golfs, can we?

///—pronounced slashes—is a fun little language based on the s/// regex-replacement function of Perl fame. It contains only two special characters, slash / and backslash \. You can find a full article on it at the esolangs wiki, but I will reproduce a description of the language below, as well as some examples.

In short, it works by identifying /pattern/repl/rest in the program and making the substitution as many times as possible. No characters are special except / and \: / demarcates patterns and replacements in the program, while \ allows you to insert literal / or \ characters into your code. Notably, these are not regular expressions, just plain string substitutions.

Your challenge is to produce an interpreter for the /// language, as either a program reading STDIN or a function taking a string argument, in as few characters as possible.

You may use any language except for /// itself. You may not use any libraries that interpret ///; you may, however, use regexes, regex libraries, or string-matching libraries.

Execution

There are four states, print, pattern, replacement, and substitution. In every state except substitution:

If the program is empty, execution halts.

Else, if the first character is \, do something with the next character (if present) and remove both from the program.

Else, if the first character is /, remove it, and change to the next state.

Else, do something with the first character and remove it from the program.

Repeat.

The states cycle through print, pattern, replacement, and substitution in order.

In print mode, 'do something' means output the character.

In pattern mode, 'do something' means add the character to the current Pattern.

In replacement mode, 'do something' means add the character to the current Replacement.

In substitution mode, you follow a different set of rules. Repeatedly substitute the first occurrence of the current Pattern with the current Replacement in the program, until no more substitutions are possible. At that point, clear the Pattern and Replacement and return to print mode.

In the program /foo/foobar/foo foo foo, the following happens:

```<code>/foo/foobar/foo foo foo
foo foo foo
foobar foo foo
foobarbar foo foo
foobarbarbar foo foo
...
</code>```

This loops forever and never exits substitution mode. Similarly, if the Pattern is empty, then the first occurrence of the empty string—at the beginning of the program—always matches, so substitution mode loops forever, never halting.

Examples

```<code>no
</code>```

Output: no.

```<code>/ world! world!/Hello,/ world! world! world!
</code>```

Output: Hello, world!.

```<code>/foo/Hello, world!//B\/\\R/foo/B/\R
</code>```

Output: Hello, world!.

```<code>a/ab/bbaa/abb
</code>```

Output: a. Program does not halt.

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

Output: none.

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

Output: none. Program does not halt.

```<code>/\\/good/\/
</code>```

Output: good.

There is also a quine on the wiki you can try.

答:
Pip, <s>100</s> 102 bytes

I hadn't ever proven Pip to be Turing-complete (though it's pretty obviously so), and instead of going the usual route of BF I thought /// would be interesting. Once I had the solution, I figured I'd golf it and post it here.

101 bytes of code, +1 for -r flag:

```<code>i:gJnf:{a:xW#i&'/NE YPOia.:yQ'\?POiya}W#iI'\Q YPOiOPOiEIyQ'/{p:VfY0s:VfIyQ'/WpNi&YviR:Xp{++y?ps}}E Oy
</code>```

Here's my ungolfed version with copious comments:

```<code>; Use the -r flag to read the /// program from stdin
; Stdin is read into g as a list of lines; join them on newline and assign to c for code
c : gJn

; Loop while c is nonempty
W #c {
 ; Pop the first character of c and yank into y
 Y POc
 ; If y equals "\"
 I yQ'\
  ; Pop c again and output
  O POc
 ; Else if y equals "/"
 EI yQ'/ {
  ; Build up pattern p from empty string
  p : ""
  ; Pop c, yank into y, loop while that is not equal to "/" and c is nonempty
  W #c & '/ NE Y POc {
   ; If y equals "\"
   I yQ'\
    ; Pop c again and add that character to p
    p .: POc
   ; Else, add y to p
   E p .: y
  }

  ; Yank 0 so we can reliably tell whether the /// construct was completed or not
  Y0
  ; Build up substitution s from empty string
  s : ""
  ; Pop c, yank into y, loop while that is not equal to "/" and c is nonempty
  W #c & '/ NE Y POc {
   ; If y equals "\"
   I yQ'\
    ; Pop c again and add that character to s
    s .: POc
   ; Else, add y to s
   E s .: y
  }

  ; If the last value yanked was "/", then we have a complete substitution
  ; If not, the code must have run out; skip this branch, and then the outer loop
  ; will terminate
  I yQ'/ {
   ; While pattern is found in code:
   W pNc {
    ; Set flag so only one replacement gets done
    i : 0
    ; Convert p to a regex; replace it using a callback function: if ++i is 1,
    ; replace with s; otherwise, leave unchanged
    c R: Xp {++i=1 ? s p}
   }
  }
 }
 ; Else, output y
 E Oy
}
</code>```

Try it online! (Note that TIO doesn't give any output when the program is non-terminating, and it also has a time limit. For larger examples and infinite loops, running Pip from the command line is recommended.)

Title: Interpret /// (pronounced 'slashes')

Body:
Pip, <s>100</s> 102 bytes

I hadn't ever proven Pip to be Turing-complete (though it's pretty obviously so), and instead of going the usual route of BF I thought /// would be interesting. Once I had the solution, I figured I'd golf it and post it here.

101 bytes of code, +1 for -r flag:

i:gJnf:{a:xW#i&'/NE YPOia.:yQ'\?POiya}W#iI'\Q YPOiOPOiEIyQ'/{p:VfY0s:VfIyQ'/WpNi&YviR:Xp{++y?ps}}E Oy

Here's my ungolfed version with copious comments:

; Use the -r flag to read the /// program from stdin
; Stdin is read into g as a list of lines; join them on newline and assign to c for code
c : gJn

; Loop while c is nonempty
W #c {
 ; Pop the first character of c and yank into y
 Y POc
 ; If y equals "\"
 I yQ'\
  ; Pop c again and output
  O POc
 ; Else if y equals "/"
 EI yQ'/ {
  ; Build up pattern p from empty string
  p : ""
  ; Pop c, yank into y, loop while that is not equal to "/" and c is nonempty
  W #c & '/ NE Y POc {
   ; If y equals "\"
   I yQ'\
    ; Pop c again and add that character to p
    p .: POc
   ; Else, add y to p
   E p .: y
  }

  ; Yank 0 so we can reliably tell whether the /// construct was completed or not
  Y0
  ; Build up substitution s from empty string
  s : ""
  ; Pop c, yank into y, loop while that is not equal to "/" and c is nonempty
  W #c & '/ NE Y POc {
   ; If y equals "\"
   I yQ'\
    ; Pop c again and add that character to s
    s .: POc
   ; Else, add y to s
   E s .: y
  }

  ; If the last value yanked was "/", then we have a complete substitution
  ; If not, the code must have run out; skip this branch, and then the outer loop
  ; will terminate
  I yQ'/ {
   ; While pattern is found in code:
   W pNc {
    ; Set flag so only one replacement gets done
    i : 0
    ; Convert p to a regex; replace it using a callback function: if ++i is 1,
    ; replace with s; otherwise, leave unchanged
    c R: Xp {++i=1 ? s p}
   }
  }
 }
 ; Else, output y
 E Oy
}

Try it online! (Note that TIO doesn't give any output when the program is non-terminating, and it also has a time limit. For larger examples and infinite loops, running Pip from the command line is recommended.)


问:
Reverse and Invert a String

Reverse and Invert a String

Challenge

In this challenge. You'll be writing a program which will output or return the input, reversed and inverted.

First, each character should be converted to its character code. Then, that should be converted to base-2. Following, that string should be reversed. After, the string should be inverted (1 -> 0 and 0 -> 1). Finally, that should be converted back to base 2 and then converted back to a character. If an character results to be an unprintable, you may optionally output it but they do not have to be removed.

```<code>H -> 72  -> 1001000 -> 0001001 -> 1110110 -> 118 -> v
e -> 101 -> 1100101 -> 1010011 -> 0101100 -> 44  -> ,
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
o -> 111 -> 1101111 -> 1111011 -> 0000100 -> 4   -> (unprintable)
, -> 44  -> 101100  -> 001101  -> 110010  -> 50  -> 2
  -> 32  -> 100000  -> 000001  -> 111110  -> 62  -> >
W -> 87  -> 1010111 -> 1110101 -> 0001010 -> 10  -> (newline)
o -> 111 -> 1101111 -> 1111011 -> 0000100 -> 4   -> (unprintable)
r -> 114 -> 1110010 -> 0100111 -> 1011000 -> 88  -> X
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
d -> 100 -> 1100100 -> 0010011 -> 1101100 -> 108 -> l
! -> 33  -> 100001  -> 100001  -> 011110  -> 30  -> (unprintable)
</code>```

Scoring

Shortest code in bytes wins.

-15% Bonus: if your program removes un-printables from the output. This must be at least all characters below 32 except newlines (char 10)

答:
Jelly, 6 bytes

```<code>OBU¬ḄỌ
</code>```

Try it online!

Explanation:

```<code>OBU¬ḄỌ Main link: z
O      Convert z to a list of character codes.
 B     Convert the codes to bit lists.
  U    Reverse the bits (not the lists).
   ¬   Invert the bits.
    Ḅ  Convert back to decimal.
     Ọ Convert back to string.
</code>```

Title: Reverse and Invert a String

Body:
Jelly, 6 bytes

OBU¬ḄỌ

Try it online!

Explanation:

OBU¬ḄỌ Main link: z
O      Convert z to a list of character codes.
 B     Convert the codes to bit lists.
  U    Reverse the bits (not the lists).
   ¬   Invert the bits.
    Ḅ  Convert back to decimal.
     Ọ Convert back to string.


答:
Racket 250 15% bonus = 212 bytes

```<code>(λ(s)(list->string(map integer->char(filter(λ(x)(or(> x 31)(= x 10)))(for/list((i(string->list s)))(string->number(string-append
"#b"(list->string(map(λ(i)(if(equal? #\0 i)#\1 #\0))(reverse(string->list(number->string(char->integer i)2))))))))))))
</code>```

Ungolfed:

```<code>(define (f s)
    (list->string
     (map
      integer->char
      (filter
       (λ(x)(or(> x 31)(= x 10)))

       (for/list ((i (string->list s)))
         (string->number
          (string-append
           "#b"
           (list->string
            (map
             (λ(i)(if(equal? #\0 i) #\1 #\0))
             (reverse
              (string->list
               (number->string
                (char->integer i) 2)
               )))))))))))
</code>```

Testing:

```<code>(f "Hello, World!")
</code>```

Output:

```<code>"v,dd2>\nXdl"
</code>```

Title: Reverse and Invert a String

Body:
Reverse and Invert a String

Challenge

In this challenge. You'll be writing a program which will output or return the input, reversed and inverted.

First, each character should be converted to its character code. Then, that should be converted to base-2. Following, that string should be reversed. After, the string should be inverted (1 -> 0 and 0 -> 1). Finally, that should be converted back to base 2 and then converted back to a character. If an character results to be an unprintable, you may optionally output it but they do not have to be removed.

```<code>H -> 72  -> 1001000 -> 0001001 -> 1110110 -> 118 -> v
e -> 101 -> 1100101 -> 1010011 -> 0101100 -> 44  -> ,
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
o -> 111 -> 1101111 -> 1111011 -> 0000100 -> 4   -> (unprintable)
, -> 44  -> 101100  -> 001101  -> 110010  -> 50  -> 2
  -> 32  -> 100000  -> 000001  -> 111110  -> 62  -> >
W -> 87  -> 1010111 -> 1110101 -> 0001010 -> 10  -> (newline)
o -> 111 -> 1101111 -> 1111011 -> 0000100 -> 4   -> (unprintable)
r -> 114 -> 1110010 -> 0100111 -> 1011000 -> 88  -> X
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
d -> 100 -> 1100100 -> 0010011 -> 1101100 -> 108 -> l
! -> 33  -> 100001  -> 100001  -> 011110  -> 30  -> (unprintable)
</code>```

Scoring

Shortest code in bytes wins.

-15% Bonus: if your program removes un-printables from the output. This must be at least all characters below 32 except newlines (char 10)

Body:
Racket 250 15% bonus = 212 bytes

(λ(s)(list->string(map integer->char(filter(λ(x)(or(> x 31)(= x 10)))(for/list((i(string->list s)))(string->number(string-append
"#b"(list->string(map(λ(i)(if(equal? #\0 i)#\1 #\0))(reverse(string->list(number->string(char->integer i)2))))))))))))

Ungolfed:

(define (f s)
    (list->string
     (map
      integer->char
      (filter
       (λ(x)(or(> x 31)(= x 10)))

       (for/list ((i (string->list s)))
         (string->number
          (string-append
           "#b"
           (list->string
            (map
             (λ(i)(if(equal? #\0 i) #\1 #\0))
             (reverse
              (string->list
               (number->string
                (char->integer i) 2)
               )))))))))))

Testing:

(f "Hello, World!")

Output:

"v,dd2>\nXdl"


问:
"Hello, World!"
So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of <s>Wikipedia</s> (the Wikipedia entry has been deleted but there is a copy at archive.org
), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

The Rules

Each submission must be a full program.

The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.

The program must not write anything to STDERR.

If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.

This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

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

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](https://esolangs.org/wiki/Fish), 121 bytes
</code>```

/* Configuration */

var QUESTION_ID = 55422; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 500px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
FEU, 15 bytes

As sed, need empty input.

```<code>a/Hello, World!
</code>```

Try it online!

Append Hello, World! to the input and the inout is implicitely printed.

Alternative (boring) version, taking no input:

```<code>__DATA__
Hello, World!
</code>```

Try it online!

Title: "Hello, World!"

Body:
FEU, 15 bytes

As sed, need empty input.

a/Hello, World!

Try it online!

Append Hello, World! to the input and the inout is implicitely printed.

Alternative (boring) version, taking no input:

__DATA__
Hello, World!

Try it online!


问:
Make an error quine!
Your challenge: write a "program", for a language of your choice, that causes the compiler/interpreter/runtime to produce error output when compiling/running your program which is identical to your program's source code.

Rules:

Your program may be specific to a particular version or implementation of your language's compiler/interpreter/runtime environment. If so, please specify the particulars.

Only standard compiler/interpreter/runtime options are permitted. You cannot pass some weird flag to your compiler to get a specific result.

The program does not need to be syntactically or semantically valid, but I may give a bounty to the best syntactically valid submission.

The program must not produce any output of its own (e.g. by calling a print or output function). All output generated upon attempting to compile/run the program must originate from the compiler/interpreter/runtime.

The complete output of the compiler/interpreter/runtime must be exactly identical to your program source code.

The compiler/interpreter/runtime must generate at least one error message when invoked with your program.

This is a popularity contest. Most creative answer, as determined by upvotes, wins. If you can give a good case for using a standard loophole, you may do so.

答:
JavaScript

```<code>Uncaught SyntaxError: Unexpected identifier
</code>```

Throws a generic Unexpected identifier error (in Chrome, at least) because it doesn't recognize Uncaught as an identifier.

Title: Make an error quine!

Body:
JavaScript

Uncaught SyntaxError: Unexpected identifier

Throws a generic Unexpected identifier error (in Chrome, at least) because it doesn't recognize Uncaught as an identifier.


答:
Bash

```<code>$ bash: bash:: command not found
bash: bash:: command not found
</code>```

Title: Make an error quine!

Body:
Your challenge: write a "program", for a language of your choice, that causes the compiler/interpreter/runtime to produce error output when compiling/running your program which is identical to your program's source code.

Rules:

Your program may be specific to a particular version or implementation of your language's compiler/interpreter/runtime environment. If so, please specify the particulars.

Only standard compiler/interpreter/runtime options are permitted. You cannot pass some weird flag to your compiler to get a specific result.

The program does not need to be syntactically or semantically valid, but I may give a bounty to the best syntactically valid submission.

The program must not produce any output of its own (e.g. by calling a print or output function). All output generated upon attempting to compile/run the program must originate from the compiler/interpreter/runtime.

The complete output of the compiler/interpreter/runtime must be exactly identical to your program source code.

The compiler/interpreter/runtime must generate at least one error message when invoked with your program.

This is a popularity contest. Most creative answer, as determined by upvotes, wins. If you can give a good case for using a standard loophole, you may do so.

Body:
Bash

$ bash: bash:: command not found
bash: bash:: command not found


答:
Elixir

```<code>== Compilation error on file e.ex ==
** (SyntaxError) e.ex:3: keyword argument must be followed by space after: ex:
    (elixir) lib/kernel/parallel_compiler.ex:114: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1
</code>```

Put the code in e.ex and compile with elixirc e.ex. There are also some blank lines in the output (and in the file), but I can't get them to appear on here; S.O. eats them.

Title: Make an error quine!

Body:
Elixir

== Compilation error on file e.ex ==
** (SyntaxError) e.ex:3: keyword argument must be followed by space after: ex:
    (elixir) lib/kernel/parallel_compiler.ex:114: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1

Put the code in e.ex and compile with elixirc e.ex. There are also some blank lines in the output (and in the file), but I can't get them to appear on here; S.O. eats them.


答:
F#

```<code>e.fs(1,11): error FS0010: Unexpected symbol ':' in implementation file
</code>```

Compile with fsc --nologo e.fs. Again, there's an extra blank line I can't properly reproduce here. (Without the --nologo flag the compiler wants to announce itself and its version number and display a Microsoft copyright message.)

Title: Make an error quine!

Body:
F#

e.fs(1,11): error FS0010: Unexpected symbol ':' in implementation file

Compile with fsc --nologo e.fs. Again, there's an extra blank line I can't properly reproduce here. (Without the --nologo flag the compiler wants to announce itself and its version number and display a Microsoft copyright message.)


Title: Print this tic-tac-toe board!

Body:
Here is a tic-tac-toe board:

```<code>   a     b     c
      |     |
1  -  |  -  |  -
 _____|_____|_____
      |     |
2  -  |  -  |  -
 _____|_____|_____
      |     |
3  -  |  -  |  -
      |     |
</code>```

Given a set of moves, print the board with the tokens on.

Input will be taken in as moves separated by spaces, with each move being:

First, the token that's going

Next, the letter of the column it is moving on

Last, the number of the row it is moving on

Note that normal tic-tac-toe rules don't matter.

Also, there is no need to print the letters and numbers.

For example, the input Ob2 Xc2 Ob3 Xa1 would result in

```<code>     |     |
  X  |  -  |  -
_____|_____|_____
     |     |
  -  |  O  |  X
_____|_____|_____
     |     |
  -  |  O  |  -
     |     |
</code>```

Remember, this is code-golf, so the code with the smallest number of bytes wins.

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

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

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code># Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code># Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the leaderboard snippet:

```<code># [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

var QUESTION_ID=95629,OVERRIDE_USER=12537;function answersUrl(e){return"https://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"https://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

```

Body:
PHP, 187 Bytes

<?for(;$i++<162;)$s.=$i%18?($i%6?($i<144&&$i%54>36?"_":($i<144&&$i%54>18&&$i%6==3?"-":" ")):"|"):"\n";foreach(explode(" ",$_GET[a])as$t)$s[20+6*(1+($t[1]<=>b))+54*($t[2]-1)]=$t[0];echo$s;

Takes the input as string. If I could use an array it can be reduce to $_GET[a] instead of explode(" ",$_GET[a])

207 Bytes

<?foreach(explode(" ",$_GET[a])as$t)$a[(1+($t[1]<=>b))+3*($t[2]-1)]=$t[0];for(;$i++<162;)$s.=$i%18?($i%6?($i<144&&$i%54>36?"_":" "):"|"):"\n";for(;$x<9;)$s[18+54*(($x/3)^0)+2+6*($x%3)]=$a[+$x++]??"-";echo$s;

The simplest idea to create this 194 Bytes

<?for(;++$i<10;)$s.=($i==9||$i%3?($i%3==2?"  -  |  -  |  -  ":"     |     |     "):"_____|_____|_____")."\n";foreach(explode(" ",$_GET[a])as$t)$s[20+6*(1+($t[1]<=>b))+54*($t[2]-1)]=$t[0];echo$s;


答:
Java, 205 - 15% = 174.2

```<code>interface F{static void main(String[]a){for(int i=0,c,s;i<a[0].length();++i){c=a[0].charAt(i);s=Integer.numberOfLeadingZeros(c);c=~(Integer.reverse(c)>>s)&-1>>>s;if(c==10|c>31)System.out.print((char)c);}}}
</code>```

Ungolfed:

```<code>interface F {
    static void main(String[] a) {
        for (int i = 0, c, s; i < a[0].length(); ++i) {
            c = a[0].charAt(i);
            s = Integer.numberOfLeadingZeros(c);
            c = ~(Integer.reverse(c) >> s) & -1 >>> s;
            if (c == 10 | c > 31) System.out.print((char)c);
        }
    }
}
</code>```

I think this solution is a bit interesting in its use of the Integer methods Integer.reverse and Integer.numberOfLeadingZeros which do what they sound like, and the shift of -1 >>> s where s is the number of leading zeroes, to get the mask to mask off high bits that we don't want. I just regret that the name of the latter method is so damn verbose, but that's what I get for golfing in Java.

Output:

```<code>v,dd2>
Xdl
</code>```

Title: Reverse and Invert a String

Body:
Java, 205 - 15% = 174.2

interface F{static void main(String[]a){for(int i=0,c,s;i<a[0].length();++i){c=a[0].charAt(i);s=Integer.numberOfLeadingZeros(c);c=~(Integer.reverse(c)>>s)&-1>>>s;if(c==10|c>31)System.out.print((char)c);}}}

Ungolfed:

interface F {
    static void main(String[] a) {
        for (int i = 0, c, s; i < a[0].length(); ++i) {
            c = a[0].charAt(i);
            s = Integer.numberOfLeadingZeros(c);
            c = ~(Integer.reverse(c) >> s) & -1 >>> s;
            if (c == 10 | c > 31) System.out.print((char)c);
        }
    }
}

I think this solution is a bit interesting in its use of the Integer methods Integer.reverse and Integer.numberOfLeadingZeros which do what they sound like, and the shift of -1 >>> s where s is the number of leading zeroes, to get the mask to mask off high bits that we don't want. I just regret that the name of the latter method is so damn verbose, but that's what I get for golfing in Java.

Output:

v,dd2>
Xdl


问:
Sum the unique numbers in a list
For this challenge, the objective is to take a list of integers, and output the sum of every unique integer in that list, i.e. count multiples of the same integer only once.

Your input will be a string in the format "{1,2,3,4}" with any amount of elements. The string will never have whitespace or be in a format that does not match the example above. A list with 0 elements should return 0.

Examples

```<code>"{1,2,3,4}" -> 10
"{5,2,5}" -> 7
"{13,13,13}" -> 13
"{-5,5,5}" -> 0
"{12,12,13,13,14,14}" -> 39
"{}" -> 0
"{3}" -> 3
</code>```

This is code-golf, so the shortest answer in bytes wins.

Good luck!

答:
C#, 103 bytes

```<code>(i)=>i[1]=='}'?0:Regex.Match(i,"{(.*)}").Groups[1].Value.Split(',').Select(int.Parse).Distinct().Sum();
</code>```

this challange its pretty pointless really

Title: Sum the unique numbers in a list

Body:
C#, 103 bytes

(i)=>i[1]=='}'?0:Regex.Match(i,"{(.*)}").Groups[1].Value.Split(',').Select(int.Parse).Distinct().Sum();

this challange its pretty pointless really


答:
ListSharp, 134 bytes

```<code>STRG s=INPUT[""] AS STRG
SHOW=ROWSPLIT STRG["0"+GETRANGE s FROM [2] TO [s LENGTH-1]] BY [","]<c#.Select(int.Parse).Distinct().Sum()c#>
</code>```

Title: Sum the unique numbers in a list

Body:
For this challenge, the objective is to take a list of integers, and output the sum of every unique integer in that list, i.e. count multiples of the same integer only once.

Your input will be a string in the format "{1,2,3,4}" with any amount of elements. The string will never have whitespace or be in a format that does not match the example above. A list with 0 elements should return 0.

Examples

```<code>"{1,2,3,4}" -> 10
"{5,2,5}" -> 7
"{13,13,13}" -> 13
"{-5,5,5}" -> 0
"{12,12,13,13,14,14}" -> 39
"{}" -> 0
"{3}" -> 3
</code>```

This is code-golf, so the shortest answer in bytes wins.

Good luck!

Body:
ListSharp, 134 bytes

STRG s=INPUT[""] AS STRG
SHOW=ROWSPLIT STRG["0"+GETRANGE s FROM [2] TO [s LENGTH-1]] BY [","]<c#.Select(int.Parse).Distinct().Sum()c#>


问:
Folding Numbers
Given a number determine if it is a folding number.

A folding number is a number such that if you take it binary representation and "fold" it in half,  That is take the result of XNOR multiplication of the first half of the number and the second half with it digits in reverse, you will get zero.

If the number has a odd number of digits in binary its middle digit must be 1 and is ignored when folding.

Since that might be a bit confusing I will give some examples:

178

The binary representation of 178 is

```<code>10110010
</code>```

To fold this we first split it in half

```<code>1011 0010
</code>```

We reverse the second half

```<code>1011
0100
</code>```

And we XNOR the two halves:

```<code>0000
</code>```

This is zero so this is a folding number.

1644

The binary representation of 1644 is

```<code>11001101100
</code>```

To fold this we first split it in half

```<code>11001 1 01100
</code>```

The middle bit is 1 so we throw it out.

```<code>11001 01100
</code>```

We reverse the second half

```<code>11001
00110
</code>```

And we XNOR the two halves:

```<code>00000
</code>```

This is zero so this is a folding number.

4254

The binary representation of 4254 is

```<code>1000010011110
</code>```

To fold this we first split it in half

```<code>100001 0 011110
</code>```

The middle bit is 0 so this is not a folding number.

Task

Your task is to take in a positive number and return a truthy if the number is folding and falsy if it is not.  This is code golf so try to keep the byte count down.

Test Cases

Here are the first 99 folding numbers:

```<code>[1, 2, 6, 10, 12, 22, 28, 38, 42, 52, 56, 78, 90, 108, 120, 142, 150, 170, 178, 204, 212, 232, 240, 286, 310, 346, 370, 412, 436, 472, 496, 542, 558, 598, 614, 666, 682, 722, 738, 796, 812, 852, 868, 920, 936, 976, 992, 1086, 1134, 1206, 1254, 1338, 1386, 1458, 1506, 1596, 1644, 1716, 1764, 1848, 1896, 1968, 2016, 2110, 2142, 2222, 2254, 2358, 2390, 2470, 2502, 2618, 2650, 2730, 2762, 2866, 2898, 2978, 3010, 3132, 3164, 3244, 3276, 3380, 3412, 3492, 3524, 3640, 3672, 3752, 3784, 3888, 3920, 4000, 4032, 4222, 4318, 4462, 4558]
</code>```

答:
Julia, 66 bytes

```<code>c(s)=s==""||s=="1"||(s[1]!=s[end]&&c(s[2:end-1]))
f(x)=c(bin(x))
</code>```

My first golf! works the same way as the Python solution of the same length,
minor differences due to language (I did come up with it on my own, though...).

Explanation:

```<code>c(s) = s == "" || # Base case, we compared all the digits from
                  # both halves.
       s == "1" || # We compared everything but left a 1 in the middle
       (s[1] != s[end] &&  # First digit neq last digit (XNOR gives 0).
        c(s[2:end-1]))     # AND the XNOR condition is satisfied for the
                           # 2nd to 2nd to last digit substring.
f(x) = c(bin(x))  # Instead of a string f takes an integer now.
</code>```

Title: Folding Numbers

Body:
Julia, 66 bytes

c(s)=s==""||s=="1"||(s[1]!=s[end]&&c(s[2:end-1]))
f(x)=c(bin(x))

My first golf! works the same way as the Python solution of the same length,
minor differences due to language (I did come up with it on my own, though...).

Explanation:

c(s) = s == "" || # Base case, we compared all the digits from
                  # both halves.
       s == "1" || # We compared everything but left a 1 in the middle
       (s[1] != s[end] &&  # First digit neq last digit (XNOR gives 0).
        c(s[2:end-1]))     # AND the XNOR condition is satisfied for the
                           # 2nd to 2nd to last digit substring.
f(x) = c(bin(x))  # Instead of a string f takes an integer now.


问:
i love yOu i lOve you i love yOu!
XKCD #99, with the title "Binary Heart" shows a simple image of ones and zeros, with some digits colored red.

The red heart is visible to the naked eye, but the message hidden in the binary sequence is not. If you remove all the spaces and newlines and interpret the binary sequence as 8 bit ASCII-code, you'll end up with the message:

```<code>iloveyOuilOveyouiloveyOuilOveyOuiloveyouilOveyouilOveyOuilOv
</code>```

Cute right?

Pssst... The string isn't a pure string repetition.

Your challenge is to create this binary image with 21 digits across, and 23 digits down. There should be exactly one space between each digit in each row, and one newline for each new row. Note that the last bits are only the beginning of the letter e, since 21*23 isn't divisible by 8. You need those bits correct too.

The function or program should not take any input. Leading and trailing spaces and newlines are accepted.

The result of your code should look like this:

```<code>0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1
1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1
1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0
1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0
1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0
1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1
0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1
0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1
0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0
1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1
0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0
1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1
0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0
1 1 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1
0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1
1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0
0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0
1 0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1
1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0
0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0
0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0
1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1
0 0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1
</code>```

This is code golf, so the shortest answer (in bytes) wins.

Leaderboard

var QUESTION_ID=94699,OVERRIDE_USER=31516;function answersUrl(e){return"https://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"https://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

```

答:
Python, 473 bytes

Colored!

```<code>r=str.replace;print r(r(r(r(r(r(r(r("""
jh0k1k1k0jk1
ikik1kjk0h1
ik0hjikih
k1h0k1k1k00k0
i1ksi1ejk0s1ke0h
i1sk0kie0si1kiek1
0ks1hje0s1k1k0ej1
j1s1kik1kjkjej
jsik0hjikiek
ksk1h0k1k1k0ej
0jsikik1kjk0ek
k1sik0hjikei1
0k1sjh0k1ke1k00
1kis1kik1k0e1kj
0ki1sk0k1k1eiki
hk1sh0ke1k1k0
0kji1sj1ke1kjk0
hi1ks0ke1ki1k1
1hk1ks1e00k1k1k
00kjikik1kjk
0hi1k0hjik
ihk1h0k1ki
000kjikik1kj1
""",'h','1010'),'i','11'),'j','01'),'k','10'),'1','1 '),'0','0 '),'s','\x1b[0;40;31m'),'e','\x1b[0m')
</code>```

Title: i love yOu i lOve you i love yOu!

Body:
Python, 473 bytes

Colored!

r=str.replace;print r(r(r(r(r(r(r(r("""
jh0k1k1k0jk1
ikik1kjk0h1
ik0hjikih
k1h0k1k1k00k0
i1ksi1ejk0s1ke0h
i1sk0kie0si1kiek1
0ks1hje0s1k1k0ej1
j1s1kik1kjkjej
jsik0hjikiek
ksk1h0k1k1k0ej
0jsikik1kjk0ek
k1sik0hjikei1
0k1sjh0k1ke1k00
1kis1kik1k0e1kj
0ki1sk0k1k1eiki
hk1sh0ke1k1k0
0kji1sj1ke1kjk0
hi1ks0ke1ki1k1
1hk1ks1e00k1k1k
00kjikik1kjk
0hi1k0hjik
ihk1h0k1ki
000kjikik1kj1
""",'h','1010'),'i','11'),'j','01'),'k','10'),'1','1 '),'0','0 '),'s','\x1b[0;40;31m'),'e','\x1b[0m')


问:
Print a Lego piece
This challenge is a simple ascii-art one. Given two inputs, describing the height and width of a Lego piece, you have print an ASCII art representation of it.

Here is how the Lego pieces are supposed to look:

```<code>(4, 2)

___________
| o o o o |
| o o o o |
-----------

(8, 2)

___________________
| o o o o o o o o |
| o o o o o o o o |
-------------------

(4, 4)

___________
| o o o o |
| o o o o |
| o o o o |
| o o o o |
-----------

(3, 2)

_________
| o o o |
| o o o |
---------

(1, 1)

o
</code>```

If you can't tell from the test-cases, the top and bottom are width*2+3 underscores and dashes, and each row has pipes for the sides, o's for the little things, and everything is separated by spaces.

The only exception for this is (1, 1), which is just a single o.

You will never get 0 for any of the dimensions.

This is code-golf, so shortest code in bytes wins!

var QUESTION_ID=84050,OVERRIDE_USER=31343;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

```

答:
PHP 7, 98 bytes

```<code><?=($P=str_pad)("",$w=3+2*$argv[1],_).$P("",$argv[2]*++$w,$P("
| ",$w-1,"o ")."|").$P("
",$w,"-");
</code>```

str_pad saves a little from str_repeat.

Juggling with preincrement on $w saves two bytes.

But version 7 is needed for assigning $r while using it at the same time.

Title: Print a Lego piece

Body:
PHP 7, 98 bytes

<?=($P=str_pad)("",$w=3+2*$argv[1],_).$P("",$argv[2]*++$w,$P("
| ",$w-1,"o ")."|").$P("
",$w,"-");

str_pad saves a little from str_repeat.

Juggling with preincrement on $w saves two bytes.

But version 7 is needed for assigning $r while using it at the same time.


问:
Simple cat program
One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after the Unix shell utility cat it is of course much less powerful than the real thing, which is normally used to print (and concatenate) several files read from disc.

Task

You should write a full program which reads the contents of the standard input stream and writes them verbatim to the standard output stream. If and only if your language does not support standard input and/or output streams (as understood in most languages), you may instead take these terms to mean their closest equivalent in your language (e.g. JavaScript's prompt and alert). These are the only admissible forms of I/O, as any other interface would largely change the nature of the task and make answers much less comparable.

The output should contain exactly the input and nothing else. The only exception to this rule is constant output of your language's interpreter that cannot be suppressed, such as a greeting, ANSI color codes or indentation. This also applies to trailing newlines. If the input does not contain a trailing newline, the output shouldn't include one either! (The only exception being if your language absolutely always prints a trailing newline after execution.)

Output to the standard error stream is ignored, so long as the standard output stream contains the expected output. In particular, this means your program can terminate with an error upon hitting the end of the stream (EOF), provided that doesn't pollute the standard output stream. If you do this, I encourage you to add an error-free version to your answer as well (for reference).

As this is intended as a challenge within each language and not between languages, there are a few language specific rules:

If it is at all possible in your language to distinguish null bytes in the standard input stream from the EOF, your program must support null bytes like any other bytes (that is, they have to be written to the standard output stream as well).

If it is at all possible in your language to support an arbitrary infinite input stream (i.e. if you can start printing bytes to the output before you hit EOF in the input), your program has to work correctly in this case. As an example yes | tr -d \\n | ./my_cat should print an infinite stream of ys. It is up to you how often you print and flush the standard output stream, but it must be guaranteed to happen after a finite amount of time, regardless of the stream (this means, in particular, that you cannot wait for a specific character like a linefeed before printing).

Please add a note to your answer about the exact behaviour regarding null-bytes, infinite streams, and extraneous output.

Additional rules

This is not about finding the language with the shortest solution for this (there are some where the empty program does the trick) - this is about finding the shortest solution in every language. Therefore, no answer will be marked as accepted.

Submissions in most languages will be scored in bytes in an appropriate preexisting encoding, usually (but not necessarily) UTF-8.

Some languages, like Folders, are a bit tricky to score. If in doubt, please ask on Meta.

Feel free to use a language (or language version) even if it's newer than this challenge. Languages specifically written to submit a 0-byte answer to this challenge are fair game but not particularly interesting.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

Also note that languages do have to fulfil our usual criteria for programming languages.

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck derivatives like Headsecks or Unary), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

Unless they have been overruled earlier, all standard code-golf rules apply, including the http://meta.codegolf.stackexchange.com/q/1061.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf; these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the author actually had to put effort into golfing the code.

Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

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

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
FEU, 0 bytes

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

Yep, the empty program works as a cat program...

Title: Simple cat program

Body:
FEU, 0 bytes

Yep, the empty program works as a cat program...


问:
Showcase of Languages

Notes

This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not create additional showcase questions.

This is no longer a popularity-contest, nor are snippet lengths limited by the vote tally. If you know this thread from before, please make sure you familiarize yourself with the changes.

This thread is dedicated to showing off interesting, useful, obscure, and/or unique features your favorite programming languages have to offer. This is neither a challenge nor a competition, but a collaboration effort to showcase as many programming languages as possible as well as possible.

How this works

All answers should include the name of the programming language at the top of the post, prefixed by a #.

Answers may contain one (and only one) factoid, i.e., a couple of sentences without code that describe the language.

Aside from the factoid, answers should consist of snippets of code, which can (but don't have to be) programs or functions.

The snippets do not need to be related. In fact, snippets that are too related may be redundant.

Since this is not a contest, all programming languages are welcome, whenever they were created.

Answers that contain more than a handful of code snippets should use a Stack Snippet to collapse everything except the factoid and one of the snippets.

Whenever possible, there should be only one answer per programming language. This is a community wiki, so feel free to add snippets to any answer, even if you haven't created it yourself. There is a Stack Snippet for compressing posts, which should mitigate the effect of the 30,000 character limit.

Answers that predate these guidelines should be edited. Please help updating them as needed.

Current answers, sorted alphabetically by language name

$.ajax({type:"GET",url:"https://api.stackexchange.com/2.2/questions/44680/answers?site=codegolf&filter=withbody",success:function(data){for(var i=0;i<data.items.length;i++){var temp=document.createElement('p');temp.innerHTML = data.items[i].body.split("\n")[0];$('#list').append('
' + temp.innerText || temp.textContent + '');}}})```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><base href="http://codegolf.stackexchange.com"><ul id="list"></ul></code>```

答:
FEU

FEU (File Edition Utility) is a heavily regex-based language to edit files.

0 bytes

Cat program. Yep.

In FEU, the input is took implicitely at the start of the program anv every command works on the input. The input is printed at the end.

1 byte

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

/ execute the next block each time the input match a regex. Here, it will crash anyway because the block is not closed (end).

2 bytes

```<code>u/
</code>```

The command u convert the input to unary, and the input is implicitely printed.

3 bytes

```<code>s/a
</code>```

s is the substitution command, so this remove the first a in the input.

Empty fields are optional.

Title: Showcase of Languages

Body:
FEU

FEU (File Edition Utility) is a heavily regex-based language to edit files.

0 bytes

Cat program. Yep.

In FEU, the input is took implicitely at the start of the program anv every command works on the input. The input is printed at the end.

1 byte

/

/ execute the next block each time the input match a regex. Here, it will crash anyway because the block is not closed (end).

2 bytes

u/

The command u convert the input to unary, and the input is implicitely printed.

3 bytes

s/a

s is the substitution command, so this remove the first a in the input.

Empty fields are optional.


问:
Surround a string with hashes
I've already made this in Python, but it seems that it could be shortened a lot:

```<code>txt = input("Type something.. ")
c = "#"
b = " "
print(c * (len(txt) + 4))
print(c, b * len(txt), c)
print(c, txt, c)
print(c, b * len(txt), c)
print(c * (len(txt) + 4))
</code>```

So if the user types:

```<code>Hello World
</code>```

The program prints:

```<code>###############
#             #
# Hello World #
#             #
###############
</code>```

Fewest bytes wins—and of course, the answer can be written in any language.

答:
PHP, <s>93</s> 91 bytes

```<code>$b=str_pad("",$e=strlen($s=" $argv[1] "));echo$h=str_pad("",2+$e,"#"),"
#$b#
#$s#
#$b#
$h";
</code>```

Takes input from command line argument; escape spaces or use single quotes. Run with -r.

Title: Surround a string with hashes

Body:
PHP, <s>93</s> 91 bytes

$b=str_pad("",$e=strlen($s=" $argv[1] "));echo$h=str_pad("",2+$e,"#"),"
#$b#
#$s#
#$b#
$h";

Takes input from command line argument; escape spaces or use single quotes. Run with -r.


答:
FEU, 360 bytes

```<code>m/a/0 1 /b/1 0 /c/1 1 /d/0 0 /e/0 /f/1 /g
__DATA__
afaeaafabeab1
cfacababaae1
cbaaeacfaca0
fafaeaafabeae0
ccacababaa0
cfbaafacfafb1
aafaeaafabea1
acfacababae1
acbaaeacfac0
faafaeaafabd1
eacfacababa0
facbaaeacfaf1
aaafaeaafabe0
cacfacababe1
aacbaafacfa1
faaafaeaafab0
aeacfacabab0
faacbaafacb1
caaafaeaafaf0
eaeacfacabaf0
aaacbaaeacf0
cfaaafaeaafa1
daeacfacaba1
</code>```

Just stupid compression

Title: i love yOu i lOve you i love yOu!

Body:
XKCD #99, with the title "Binary Heart" shows a simple image of ones and zeros, with some digits colored red.

The red heart is visible to the naked eye, but the message hidden in the binary sequence is not. If you remove all the spaces and newlines and interpret the binary sequence as 8 bit ASCII-code, you'll end up with the message:

```<code>iloveyOuilOveyouiloveyOuilOveyOuiloveyouilOveyouilOveyOuilOv
</code>```

Cute right?

Pssst... The string isn't a pure string repetition.

Your challenge is to create this binary image with 21 digits across, and 23 digits down. There should be exactly one space between each digit in each row, and one newline for each new row. Note that the last bits are only the beginning of the letter e, since 21*23 isn't divisible by 8. You need those bits correct too.

The function or program should not take any input. Leading and trailing spaces and newlines are accepted.

The result of your code should look like this:

```<code>0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1
1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1
1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0
1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0
1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0
1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1
0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1
0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1
0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0
1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1
0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0
1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1
0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0
1 1 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1
0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1
1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0
0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0
1 0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1
1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0
0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0
0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0
1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1
0 0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1
</code>```

This is code golf, so the shortest answer (in bytes) wins.

Leaderboard

var QUESTION_ID=94699,OVERRIDE_USER=31516;function answersUrl(e){return"https://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"https://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

```

Body:
FEU, 360 bytes

m/a/0 1 /b/1 0 /c/1 1 /d/0 0 /e/0 /f/1 /g
__DATA__
afaeaafabeab1
cfacababaae1
cbaaeacfaca0
fafaeaafabeae0
ccacababaa0
cfbaafacfafb1
aafaeaafabea1
acfacababae1
acbaaeacfac0
faafaeaafabd1
eacfacababa0
facbaaeacfaf1
aaafaeaafabe0
cacfacababe1
aacbaafacfa1
faaafaeaafab0
aeacfacabab0
faacbaafacb1
caaafaeaafaf0
eaeacfacabaf0
aaacbaaeacf0
cfaaafaeaafa1
daeacfacaba1

Just stupid compression


Title: Print a Lego piece

Body:
This challenge is a simple ascii-art one. Given two inputs, describing the height and width of a Lego piece, you have print an ASCII art representation of it.

Here is how the Lego pieces are supposed to look:

```<code>(4, 2)

___________
| o o o o |
| o o o o |
-----------

(8, 2)

___________________
| o o o o o o o o |
| o o o o o o o o |
-------------------

(4, 4)

___________
| o o o o |
| o o o o |
| o o o o |
| o o o o |
-----------

(3, 2)

_________
| o o o |
| o o o |
---------

(1, 1)

o
</code>```

If you can't tell from the test-cases, the top and bottom are width*2+3 underscores and dashes, and each row has pipes for the sides, o's for the little things, and everything is separated by spaces.

The only exception for this is (1, 1), which is just a single o.

You will never get 0 for any of the dimensions.

This is code-golf, so shortest code in bytes wins!

var QUESTION_ID=84050,OVERRIDE_USER=31343;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

```

Body:
Racket 174 bytes

(λ(w h)(let((dl(λ(s)(displayln s)))(d(λ(s)(display s))))(for((x(+ 3(* w 2))))(d"_"))
(dl"")(for((x h))(d"| ")(for((y w))(d"o "))(d"|")(dl""))(for((x(+ 3(* w 2))))(d"-"))))

Ungolfed:

(define (f1 w h)
    (let ((dl (λ (s) (displayln s)))
          (d (λ (s) (display s))))
      (for ((x (+ 3 (* w 2))))
        (d "_"))
      (dl "")
      (for ((x h))
        (d "| ")
        (for ((y w))
          (d "o "))
        (d "|")
        (dl ""))
      (for ((x (+ 3 (* w 2))))
        (d "-"))))

Testing:

(f 5 2)

Output:

_____________
| o o o o o |
| o o o o o |
-------------


答:
Perl, <s>56</s> 55 bytes

Includes +3 for -p

Run with the number on STDIN:

```<code>for i in 0 `seq 14`; do kitt.pl <<< $i; echo; done
</code>```

kitt.pl:

```<code>#!/usr/bin/perl -p
$_=eval'1x8
|1x(7-abs$_--%14-7).++$^F#'x3;y;1537;-+#
</code>```

Put this in a file without the final newline (add a final ; to the program if you don't want to bother with that). Unfortunately using a literal ^F doesn't work

This program contains 2 comment characters (ignore the #! line). One of them really is a comment and actually gains a byte....

Implements the actual afterglow algorithm

Title: KITT car ASCII art

Body:
The 80's TV series Knight Rider featured an intelligent, self-aware car called KITT. One distinctive aspect of the car was a front-mounted scanner bar that allowed KITT to "see" (and that looked suspiciously familiar to fans of another, earlier TV series).

The scanner had eight lights as seen in this picture:

The lights "moved" as shown in this animated image.

Your task, as you have guessed by now, it to recreate the scanner bar with the moving lights in ASCII art.

The challenge

Given an integer t, output the state of the scanner bar at that instant, defined as follows:

The scanner consists of eight lights.

At any instant one of the lights is active, and is shown as #. The lights that were active at times t-1 and t-2 are now dimmed, and are shown as +; unless they coincide with the current active one. The rest of the lights are off, and are shown as -.

The active light moves left to right, then right to left.

The exact output for each t is detailed below.

```<code>0  -->  #++-----   % The leftmost light is active, and it just came from the right.
                   % The two neighbouring lights are dimmed
1  -->  +#------   % The active light has bounced to the right, and it is covering
                   % one of the two lights that should be dimmed. So there is only
                   % one dimmed light
2  -->  ++#-----   % The active light has moved one more step to the right, and the
                   % two trailing dimmed lights are visible
3  -->  -++#----
7  -->  -----++#
8  -->  ------#+   % The active light has bounced to the left
9  -->  -----#++
10 -->  ----#++-
13 -->  -#++----
14 -->  #++-----   % Same as 0
15 -->  +#------   % Same as 1
</code>```

For negative values of t the cycle is simply extended:

```<code>-1 -->  -#++----   % Same as 13
-2 -->  --#++---   % Same as 12
</code>```

#Additional rules

You can write a program or function.

Output can contain trailing whitespace and a leading newline.

Shortest code in bytes wins.

Body:
Perl, <s>56</s> 55 bytes

Includes +3 for -p

Run with the number on STDIN:

for i in 0 `seq 14`; do kitt.pl <<< $i; echo; done

kitt.pl:

#!/usr/bin/perl -p
$_=eval'1x8
|1x(7-abs$_--%14-7).++$^F#'x3;y;1537;-+#

Put this in a file without the final newline (add a final ; to the program if you don't want to bother with that). Unfortunately using a literal ^F doesn't work

This program contains 2 comment characters (ignore the #! line). One of them really is a comment and actually gains a byte....

Implements the actual afterglow algorithm


答:
Perl, 65 bytes

Includes +1 for -n

Run with the number on STDIN:

```<code>for i in 0 `seq 14`; do perl -M5.010 kitt.pl <<< $i; done
</code>```

kitt.pl:

```<code>#!/usr/bin/perl -n
$_="311e".--$_%14+4e16|0;s/.(.{8})/$&|reverse/e;y/013/-+#/;say//
</code>```

Not very competitive but deserves a post for the strange method

Title: KITT car ASCII art

Body:
Perl, 65 bytes

Includes +1 for -n

Run with the number on STDIN:

for i in 0 `seq 14`; do perl -M5.010 kitt.pl <<< $i; done

kitt.pl:

#!/usr/bin/perl -n
$_="311e".--$_%14+4e16|0;s/.(.{8})/$&|reverse/e;y/013/-+#/;say//

Not very competitive but deserves a post for the strange method


答:
Mathematica, 205 bytes

```<code>StringReplacePart[a="     |     |
";b="  -  |  -  |  -
";c="_____|_____|_____
";{a,b,c,a,b,c,a,b,a}<>"",##]&@@Transpose[{#,{#,#}&[54LetterNumber@#2+6FromDigits@#3-39]}&@@@Characters/@StringSplit@#]&
</code>```

This would be way shorter if I could use the built-in... (92 bytes)

```<code>Grid@SparseArray[{LetterNumber@#2,FromDigits@#3}->#&@@@Characters/@StringSplit@#,{3,3},"-"]&
</code>```

Title: Print this tic-tac-toe board!

Body:
Here is a tic-tac-toe board:

```<code>   a     b     c
      |     |
1  -  |  -  |  -
 _____|_____|_____
      |     |
2  -  |  -  |  -
 _____|_____|_____
      |     |
3  -  |  -  |  -
      |     |
</code>```

Given a set of moves, print the board with the tokens on.

Input will be taken in as moves separated by spaces, with each move being:

First, the token that's going

Next, the letter of the column it is moving on

Last, the number of the row it is moving on

Note that normal tic-tac-toe rules don't matter.

Also, there is no need to print the letters and numbers.

For example, the input Ob2 Xc2 Ob3 Xa1 would result in

```<code>     |     |
  X  |  -  |  -
_____|_____|_____
     |     |
  -  |  O  |  X
_____|_____|_____
     |     |
  -  |  O  |  -
     |     |
</code>```

Remember, this is code-golf, so the code with the smallest number of bytes wins.

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

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

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code># Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code># Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the leaderboard snippet:

```<code># [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

var QUESTION_ID=95629,OVERRIDE_USER=12537;function answersUrl(e){return"https://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"https://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

```

Body:
Mathematica, 205 bytes

StringReplacePart[a="     |     |
";b="  -  |  -  |  -
";c="_____|_____|_____
";{a,b,c,a,b,c,a,b,a}<>"",##]&@@Transpose[{#,{#,#}&[54LetterNumber@#2+6FromDigits@#3-39]}&@@@Characters/@StringSplit@#]&

This would be way shorter if I could use the built-in... (92 bytes)

Grid@SparseArray[{LetterNumber@#2,FromDigits@#3}->#&@@@Characters/@StringSplit@#,{3,3},"-"]&