问:
Operator ASCII art

Challenge

Given an ASCII operator from the list below and a number n, draw an ASCII representation of the operator using that operator as the character with the line segments of the operator having length n.

Input

An ASCII character from the list = + - x / and an integer n where n >= 1.  (I'm using x instead of * and / instead of ÷, but you could use either one, whichever is easier). For + and x, you only have to handle odd numbers to avoid issues with alignment.

Output

An ASCII drawing of the operator composed of the character with segments of length n. Horizontal portions should have spaces between the characters to offset vertical/horizontal distance differences.

Rules

This is code-golf, so shortest code in bytes wins. Standard loopholes are forbidden.

Examples

Input: + 3

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

Input: = 4

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

Input: = 10

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

Input: - 2

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

Input: / 10

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

Input: x 7

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

答:
C, 331 Bytes

```<code>i,j;f(o,n){if(47==o)for(i=n;i;puts("")){for(j=i--;j--;putchar(j?32:o)){}}
if(43==o)for(i=n;i--;puts("")){for(j=n;j--;printf(i==n/2||!j?"+ ":" ")){}}
if(45==o)for(i=n;i--;putchar(o)){}
if(61==o)for(i=3;i--;puts("")){for(j=n;j--;putchar(i&1?32:o)){}}
if(120==o)for(i=n;i;puts("")){for(j=0;j++<n;putchar(j==i||j==n-i+1?o:32)){}i--;}}
</code>```

The operator is passed as ASCII code into o and the character count into n. I only added spaces between horizontally consecutive characters into the plus sign, since this was the only one where the output would have been distorted if I hadn't and in the task it only said "should". I use two nested loops counting down (except for - where I only need one line).

= Three Lines, one of them empty, straight forward

+ using printf because of the spaces

- straight forward

/ have the inner loop print at zero and start at the outer loop's counter

x have the inner loop print at the outer loop's counter and its "inverse" n-i. Still need to look at why I'am off-by-one here.

Sample call:

```<code>#include <stdio.h>
/*  =       61
    +       43
    -       45
    /       47
    Space   32
    x       120
*/
int main(int argc, char **argv){
    printf("%s\n%s\n",argv[1], argv[2]);
    f(*argv[1],strtol(argv[2],NULL,10));
}
</code>```

Title: Operator ASCII art

Body:
C, 331 Bytes

i,j;f(o,n){if(47==o)for(i=n;i;puts("")){for(j=i--;j--;putchar(j?32:o)){}}
if(43==o)for(i=n;i--;puts("")){for(j=n;j--;printf(i==n/2||!j?"+ ":" ")){}}
if(45==o)for(i=n;i--;putchar(o)){}
if(61==o)for(i=3;i--;puts("")){for(j=n;j--;putchar(i&1?32:o)){}}
if(120==o)for(i=n;i;puts("")){for(j=0;j++<n;putchar(j==i||j==n-i+1?o:32)){}i--;}}

The operator is passed as ASCII code into o and the character count into n. I only added spaces between horizontally consecutive characters into the plus sign, since this was the only one where the output would have been distorted if I hadn't and in the task it only said "should". I use two nested loops counting down (except for - where I only need one line).

= Three Lines, one of them empty, straight forward

+ using printf because of the spaces

- straight forward

/ have the inner loop print at zero and start at the outer loop's counter

x have the inner loop print at the outer loop's counter and its "inverse" n-i. Still need to look at why I'am off-by-one here.

Sample call:

#include <stdio.h>
/*  =       61
    +       43
    -       45
    /       47
    Space   32
    x       120
*/
int main(int argc, char **argv){
    printf("%s\n%s\n",argv[1], argv[2]);
    f(*argv[1],strtol(argv[2],NULL,10));
}


问:
Code ladder, Cops

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

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

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

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

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

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

Example post:

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

MyLang, 9 bytes, 8 numbers

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

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

Leaderboard

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

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

ContentLicense: CC BY-SA 3.0

Title: Code ladder, Cops

Body:
05AB1E, 11 bytes, Cracked!

3628801__0_

Works from 1-10. _ is a hidden character.

Intended Solution:

3628801R¬0+ # 1
3628801R¬1+ # 2
3628801R¬2+ # 3
3628801R¬3+ # 4
3628801R¬4+ # 5
3628801R¬5+ # 6
3628801R¬6+ # 7
3628801R¬7+ # 8
3628801R¬8+ # 9
3628801R¬9+ # 10


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

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

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

Example post:

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

Original code:

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

Code that produces 1 - 8:

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

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

答:
05AB1E, 11 bytes, 10 numbers, by Oliver

Original code:

```<code> 1: 3628801zï0>
</code>```

Other numbers

```<code> 2: 3628801zï0>>
 3: 3628801zï0>>>
 4: 3628801zï0>>>>
 5: 3628801zï0>>>>>
 6: 3628801zï0>>>>>>
 7: 3628801zï0>>>>>>>
 8: 3628801zï0>>>>>>>>
 9: 3628801zï0>>>>>>>>>
10: 3628801zï0>>>>>>>>>>
</code>```

Explanation

```<code>3628801                        # push this number
       z                       # find its reciprocal
        ï                      # round it to the nearest integer (becomes 0)
         0                     # push 0
          >>>>                 # increment by 1 for each `>` present (this is for 4)
                               # implicit output
</code>```

To summarise it, push 3628801, take its reciprocal and round that to the nearest integer (evaluates to 0). Then increment the stack. TADA!

Try it online! For output = 1 Then add as many >s as you want depending on what number you want to output.

Title: Code ladder, Robbers

Body:
05AB1E, 11 bytes, 10 numbers, by Oliver

Original code:

 1: 3628801zï0>

Other numbers

 2: 3628801zï0>>
 3: 3628801zï0>>>
 4: 3628801zï0>>>>
 5: 3628801zï0>>>>>
 6: 3628801zï0>>>>>>
 7: 3628801zï0>>>>>>>
 8: 3628801zï0>>>>>>>>
 9: 3628801zï0>>>>>>>>>
10: 3628801zï0>>>>>>>>>>

Explanation

3628801                        # push this number
       z                       # find its reciprocal
        ï                      # round it to the nearest integer (becomes 0)
         0                     # push 0
          >>>>                 # increment by 1 for each `>` present (this is for 4)
                               # implicit output

To summarise it, push 3628801, take its reciprocal and round that to the nearest integer (evaluates to 0). Then increment the stack. TADA!

Try it online! For output = 1 Then add as many >s as you want depending on what number you want to output.


答:
아희(Aheui), 19 bytes (6 chars + 1 newline), 10 numbers

```<code>봃法희
반_뭉
</code>```

Works for 1 to 10. _ is the hidden character. Shouldn't be that hard.

Bonus: It works for 0 too.

Try it online!

Title: Code ladder, Cops

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

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

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

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

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

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

Example post:

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

MyLang, 9 bytes, 8 numbers

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

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

Leaderboard

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

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Body:
아희(Aheui), 19 bytes (6 chars + 1 newline), 10 numbers

봃法희
반_뭉

Works for 1 to 10. _ is the hidden character. Shouldn't be that hard.

Bonus: It works for 0 too.

Try it online!


答:
Octave, 25 bytes, 9 numbers. Cracked

```<code>__a__repmat(__one___,__)_
</code>```

_ is a hidden character.

Title: Code ladder, Cops

Body:
Octave, 25 bytes, 9 numbers. Cracked

__a__repmat(__one___,__)_

_ is a hidden character.


问:
The meta-polyglot quine
In my time on PPCG, I've noticed that quine problems and polyglot problems are quite popular. Also, meta-solutions to problems, that is, scripts which generate a program which is the solution to a problem, tend to get a lot of positive feedback from the community. Therefore, I have created this challenge, which implements these three ideas.

Your task then, reader and code-golf enthusiast, is to create as short as possible a script which can run in two languages A and B to generate quines for A and B. When your program is run in language A, it should generate a program that is a quine in language B but not in language A and vice versa. The languages A and B can be different version of the same language, provided you keep in mind that the generated quines should only work in one of the versions.

Keep in mind that the standard loopholes should be considered closed and only proper quines are allowed.

Good luck, fewest characters wins!

答:
Befunge / Fission, 35 bytes

```<code>"$TQ-#'">,#-:#2_@;"+1_@#`+66:,g0:"L
</code>```

Try it in Befunge |
Try it in Fission

In Befunge this produces the Fission quine:

```<code>'!+OR"
</code>```

In Fission this produces the Befunge quine:

```<code>:0g,:66+`#@_1+
</code>```

Title: The meta-polyglot quine

Body:
Befunge / Fission, 35 bytes

"$TQ-#'">,#-:#2_@;"+1_@#`+66:,g0:"L

Try it in Befunge |
Try it in Fission

In Befunge this produces the Fission quine:

'!+OR"

In Fission this produces the Befunge quine:

:0g,:66+`#@_1+


问:
Blueprint a sestina
A sestina is a format of poem that follows an interesting pattern that we can generate. It has six stanzas of six lines each, where the last words of each line in the first stanza make up the line endings in each successive stanza, rotated in a set pattern. (There's also a three-line stanza at the end, but we won't worry about that.) Take a look at the first three stanzas of Elizabeth Bishop's creatively named Sestina:

September rain falls on the house.

  In the failing light, the old grandmother

  sits in the kitchen with the child

  beside the Little Marvel Stove,

  reading the jokes from the almanac,

  laughing and talking to hide her tears.

She thinks that her equinoctial tears

  and the rain that beats on the roof of the house

  were both foretold by the almanac,

  but only known to a grandmother.

  The iron kettle sings on the stove.

  She cuts some bread and says to the child,

It's time for tea now; but the child

  is watching the teakettle's
  small hard tears

  dance like mad on the hot black stove,

  the way the rain must dance on the house.

  Tidying up, the old grandmother

  hangs up the clever almanac

...

Note how each line ends with one of the six words "house," "grandmother," "child," "stove," "almanac," or "tears." Not only that, but the words are ordered in the pattern 6–1—5–2—4–3, relative to the previous stanza. It ends up looking like a spiral:

We're still a few years away from programmatically generating a full sestina, but we can create a template featuring the end words of each stanza in proper order. Write a program or function that, given the six line ending words, outputs the blueprint for a sestina, following these rules. Here is the expected result for the input house grandmother child stove almanac tears:

```<code>house
grandmother
child
stove
almanac
tears

tears
house
almanac
grandmother
stove
child

child
tears
stove
house
grandmother
almanac

almanac
child
grandmother
tears
house
stove

stove
almanac
house
child
tears
grandmother

grandmother
stove
tears
almanac
child
house
</code>```

The first stanza is the words in original order, the second stanza is in the order 6-1-5-2-4-3 from the first. The third stanza is that order relative to the second, and so on, all the way to stanza 6.

Assume that the input words will always be only letters, uppercase or lowercase. You can take them as an array of strings or a single string delimited by a non-letter character (space, newline, etc.). In the output, lines are separated by newlines (0x0A), and stanzas separated by two newlines. A trailing newline is acceptable.

This is code-golf, so shortest code in bytes wins. That being said, it may be shorter to compress the whole poem's structure, but I'd like to see some solutions that base each stanza on the previous.

答:
MATL, <s>18</s> 17 bytes

```<code>0ch5:"t[6l5H4I7])
</code>```

Input is a cell array of strings, in the format

```<code>{'house' 'grandmother' 'child' 'stove' 'almanac' 'tears'}
</code>```

Try it online!

Explanation

```<code>0c          % Push string with a single space, to be used as separator
h           % Input array of 6 strings implicitly and append the above string
5:"         % Repeat 5 times
  t         %   Duplicate the array of strings (previous stanza plus separator)
  [6l5H4I7] %   Push array [6 1 5 2 4 3 7]. The 7th string is the separator, and stays
            %   at the end. The other strings are shuffled as required
  )         %   Index into the array of strings
            % End implicitly
            % Display implicitly
</code>```

Title: Blueprint a sestina

Body:
MATL, <s>18</s> 17 bytes

0ch5:"t[6l5H4I7])

Input is a cell array of strings, in the format

{'house' 'grandmother' 'child' 'stove' 'almanac' 'tears'}

Try it online!

Explanation

0c          % Push string with a single space, to be used as separator
h           % Input array of 6 strings implicitly and append the above string
5:"         % Repeat 5 times
  t         %   Duplicate the array of strings (previous stanza plus separator)
  [6l5H4I7] %   Push array [6 1 5 2 4 3 7]. The 7th string is the separator, and stays
            %   at the end. The other strings are shuffled as required
  )         %   Index into the array of strings
            % End implicitly
            % Display implicitly


问:
Steganographic Squares

Steganographic Squares

Your job is to take in a string, and generate an NxN image that represents this string. You must also write the algorithm that takes in the image and turns it back into a string as well. The scoring will be will include the byte count of both algorithms:

"Encryption" Algorithm + "Decryption" Algorithm.

You should post each separately, with byte-counts for both the encryption and decryption algorithms displayed individually.

Example Algorithm

For instance, here's the "Programming Puzzles and Code Golf" using a simple ASCII based steganographic algorithm in the Blue channel:

```<code>#2e7250,#6ea972,#04eb6f,#0fc767,#74ab72,#ee6161
#b73b6d,#1aae6d,#f37169,#bda56e,#1fe367,#e99620
#706450,#0d3575,#146b7a,#4ea47a,#2a856c,#95d065
#3f2d73,#cef720,#bab661,#d1b86e,#f22564,#12b820
#0f3d43,#c86e6f,#1ee864,#a66565,#247c20,#c3bb47
#0e296f,#89d46c,#585b66,#c08f20,#455c20,#136f20
</code>```

Actual Image (  )

You can see the blue channel simply holds the ascii values for this image:

```<code>50 =  80(P) 72 = 114(r) 6f = 111(o) 67 = 103(g) 72 = 114(r) 61 =  97(a)
6d = 109(m) 6d = 109(m) 69 = 105(i) 6e = 110(n) 67 = 103(g) 20 =  32( )
50 =  80(P) 75 = 117(u) 7a = 122(z) 7a = 122(z) 6c = 108(l) 65 = 101(e)
73 = 115(s) 20 =  32( ) 61 =  97(a) 6e = 110(n) 64 = 100(d) 20 =  32( )
43 =  67(C) 6f = 111(o) 64 = 100(d) 65 = 101(e) 20 =  32( ) 47 =  71(G)
6f = 111(o) 6c = 108(l) 66 = 102(f) 20 =  32( ) 20 =  32( ) 20 =  32( )
</code>```

While the rest of the channels hold randomly generated values to "spice up" the variety of colors in the image. When pulling the message back out of the image, we can just simply ignore the other channel values, and pull the hex bit in the blue channel, reconstructing the string:

```<code>"Programming Puzzles and Code Golf"
</code>```

Notice the spaces that were used to pad the string in the square are not included in the final decrypted output. While you must pad the string in the image, you may assume that the input string will not end with spaces.

Rules

You must encode 1 character per pixel, the channel chosen to encode the char is arbitrary.

The channels of the other RGB colors must be randomized, other than the one you're choosing to encode the string into; this means your final non-encoded channels would need to be between 0x0000-0xFFFF (randomly chosen).

Expressing the final result as a 2D array of RGB color values is fine 0x000000-0xFFFFFF, no need to use image creation unless you want to have fun with it or if it's less bytes. If you choose to output as hex strings, prefix the hex string with # E.G. #FFFFFF or #05AB1E. You may separate with tabs, commas, or anything else that would be horizontally sensible, but it must maintain the square pattern; in other words, you must use appropriate newline separation.

The output must be in a square, and the string must be padded with spaces at the end to accomodate this. This means that N≈SQRT(Input#Length()). If the input length is not a perfect square, you should round up on N and pad with spaces.

As stated previously, if you are padding with spaces in the image, you must not include the padded characters in the final "decrypted" output.

You can assume that:

The input string will not end with spaces.

The input string will only use printable ASCII characters.

This is code-golf, lowest byte count wins.

答:
Python 2, <s>164</s> 160 + <s>94</s> 93 = 253 bytes

Saved 1+1 byte thanks to Wheat Wizard.

-5 bytes thanks to Kade

Encoder: string must be enclosed in quotes, e.g. "CodeGolf", output is a color ascii PPM image.

from random import*
s=input()
n=int((len(s)-1)**0.5)+1
s=s.ljust(n*n)
r=randint
print"P3 %d %d 255 "%(n,n)+''.join("%d "*3%(r(0,255),r(0,255),ord(c))for c in s)
```
<p><img src="https://i.stack.imgur.com/hI2tP.png" alt="Decoder Picture" />Decoder: Takes input filename as command line argument</p>
<pre class="lang-python prettyprint-override"><code>from sys import*
print''.join(chr(int(c))for c in open(argv[1]).read().split()[6::3]).strip()
</code>```

Usage:

 python golf_stegansquare_enc.py > stega.ppm

 python golf_stegansquare_dec.py stega.ppm
```

Example:

Programming Puzzles and Code Golf

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Title: Steganographic Squares

Body:
Python 2, <s>164</s> 160 + <s>94</s> 93 = 253 bytes

Saved 1+1 byte thanks to Wheat Wizard.

-5 bytes thanks to Kade

Encoder: string must be enclosed in quotes, e.g. "CodeGolf", output is a color ascii PPM image.

from random import*
s=input()
n=int((len(s)-1)**0.5)+1
s=s.ljust(n*n)
r=randint
print"P3 %d %d 255 "%(n,n)+''.join("%d "*3%(r(0,255),r(0,255),ord(c))for c in s)

Decoder: Takes input filename as command line argument

from sys import*
print''.join(chr(int(c))for c in open(argv[1]).read().split()[6::3]).strip()

Usage:

 python golf_stegansquare_enc.py > stega.ppm

 python golf_stegansquare_dec.py stega.ppm

Example:

Programming Puzzles and Code Golf

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.


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

Cops' Task

For the cops' thread, click here.

Robbers' Task

Find an uncracked submission on the cops' thread. (A submission may only be cracked once.)

Unscramble the code to find a working quine.

Post an answer on the robbers' thread. Include the language, the byte count, the user who posted the scrambled code, a link to that answer, and the unscrambled code.

Here is an example of a robber submission:

Python, 29 bytes, Oliver

```<code>_='_=%r;print _%%_';print _%_
</code>```

Scoring

The user with the most cracks will be the winner of this section.

答:
JavaScript ES6, 49 bytes, Mama Fun Roll

```<code>function f(){return    `${(((((k=>f+'')(f)))))}`}
</code>```

Pretty much the standard JS function quine, with a little obfuscation.

Title: Quine Anagrams! (Robbers' Thread)

Body:
JavaScript ES6, 49 bytes, Mama Fun Roll

function f(){return    `${(((((k=>f+'')(f)))))}`}

Pretty much the standard JS function quine, with a little obfuscation.


答:
Mathematica, 59 bytes

```<code>r=Riffle;""<>Flatten@r[NestList[RotateRight,#,5],""]~r~"\n"&
</code>```

The core of this unnamed function is NestList[RotateRight,#,5], which takes an input list of length 6 and creates a list of 6 lists, each rotated in the sestina way. Indeed, if a list of lists-of-strings is acceptable output, then NestList[RotateRight,#,5]& does the job in 26 bytes.

Then, r[...,""] inserts an empty string between each of the 6 lists; Flatten turns the whole thing into a single list of strings; ~r~"\n" then inserts a newline between each of those strings; and ""<> concatenates the whole thing into a single string. Thus the other 33 bytes are just to convert the structured output into a single string.

Title: Blueprint a sestina

Body:
A sestina is a format of poem that follows an interesting pattern that we can generate. It has six stanzas of six lines each, where the last words of each line in the first stanza make up the line endings in each successive stanza, rotated in a set pattern. (There's also a three-line stanza at the end, but we won't worry about that.) Take a look at the first three stanzas of Elizabeth Bishop's creatively named Sestina:

September rain falls on the house.

  In the failing light, the old grandmother

  sits in the kitchen with the child

  beside the Little Marvel Stove,

  reading the jokes from the almanac,

  laughing and talking to hide her tears.

She thinks that her equinoctial tears

  and the rain that beats on the roof of the house

  were both foretold by the almanac,

  but only known to a grandmother.

  The iron kettle sings on the stove.

  She cuts some bread and says to the child,

It's time for tea now; but the child

  is watching the teakettle's
  small hard tears

  dance like mad on the hot black stove,

  the way the rain must dance on the house.

  Tidying up, the old grandmother

  hangs up the clever almanac

...

Note how each line ends with one of the six words "house," "grandmother," "child," "stove," "almanac," or "tears." Not only that, but the words are ordered in the pattern 6–1—5–2—4–3, relative to the previous stanza. It ends up looking like a spiral:

We're still a few years away from programmatically generating a full sestina, but we can create a template featuring the end words of each stanza in proper order. Write a program or function that, given the six line ending words, outputs the blueprint for a sestina, following these rules. Here is the expected result for the input house grandmother child stove almanac tears:

```<code>house
grandmother
child
stove
almanac
tears

tears
house
almanac
grandmother
stove
child

child
tears
stove
house
grandmother
almanac

almanac
child
grandmother
tears
house
stove

stove
almanac
house
child
tears
grandmother

grandmother
stove
tears
almanac
child
house
</code>```

The first stanza is the words in original order, the second stanza is in the order 6-1-5-2-4-3 from the first. The third stanza is that order relative to the second, and so on, all the way to stanza 6.

Assume that the input words will always be only letters, uppercase or lowercase. You can take them as an array of strings or a single string delimited by a non-letter character (space, newline, etc.). In the output, lines are separated by newlines (0x0A), and stanzas separated by two newlines. A trailing newline is acceptable.

This is code-golf, so shortest code in bytes wins. That being said, it may be shorter to compress the whole poem's structure, but I'd like to see some solutions that base each stanza on the previous.

Body:
Mathematica, 59 bytes

r=Riffle;""<>Flatten@r[NestList[RotateRight,#,5],""]~r~"\n"&

The core of this unnamed function is NestList[RotateRight,#,5], which takes an input list of length 6 and creates a list of 6 lists, each rotated in the sestina way. Indeed, if a list of lists-of-strings is acceptable output, then NestList[RotateRight,#,5]& does the job in 26 bytes.

Then, r[...,""] inserts an empty string between each of the 6 lists; Flatten turns the whole thing into a single list of strings; ~r~"\n" then inserts a newline between each of those strings; and ""<> concatenates the whole thing into a single string. Thus the other 33 bytes are just to convert the structured output into a single string.


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

Cops' Task

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

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

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

Your program may not print to STDERR.

Here is an example of a cop submission:

Python, 29 bytes

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

Robbers' Task

For the robbers' thread, click here.

Safe Submissions

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

Scoring

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

Leaderboard

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

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

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

If your submission gets cracked, please format like this:

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

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

If your submission is safe, format like this:

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

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

```

答:
JavaScript, 147 bytes, Cracked by ETHProductions

I'll be very impressed if someone manages to crack this...

```<code>   """"''''((((()))))+++++++++.//99;;;;;;=========>>[[[[[]]]]]``````````````cccdddddddeeeeeeeeeeeffiiiiiiinnnnnnnoooooooorrrrrrrrsttttuuwwwwwwx{{}}
</code>```

Intended solution:

```<code>e=o=>{n=o;``[r=`constructor`][r](`return e=>{`+o+`}`)````};d=e+"";e`for(i in window)if(/ert/.exec(i))w=window[i];w('e='+d+';d=e+"";e'+d[9]+n+d[9])`
```

Title: Quine Anagrams! (Cops' Thread)

Body:
JavaScript, 147 bytes, Cracked by ETHProductions

I'll be very impressed if someone manages to crack this...

   """"''''((((()))))+++++++++.//99;;;;;;=========>>[[[[[]]]]]``````````````cccdddddddeeeeeeeeeeeffiiiiiiinnnnnnnoooooooorrrrrrrrsttttuuwwwwwwx{{}}

Intended solution:

e=o=>{n=o;``[r=`constructor`][r](`return e=>{`+o+`}`)````};d=e+"";e`for(i in window)if(/ert/.exec(i))w=window[i];w('e='+d+';d=e+"";e'+d[9]+n+d[9])`


答:
Batch, 99 bytes

```<code>@for %%w in (%*)do @if not .%%w==.%7 echo %%w
@echo(
@if not .%7==...... %0 %6 %1 %5 %2 %4 %3 .%7
</code>```

Explanation: Takes input as command-line parameters. The %0 causes it to loop around, accumulating .s in the originally empty 7th parameter. The extra . is because if doesn't work on empty strings.

Title: Blueprint a sestina

Body:
Batch, 99 bytes

@for %%w in (%*)do @if not .%%w==.%7 echo %%w
@echo(
@if not .%7==...... %0 %6 %1 %5 %2 %4 %3 .%7

Explanation: Takes input as command-line parameters. The %0 causes it to loop around, accumulating .s in the originally empty 7th parameter. The extra . is because if doesn't work on empty strings.


答:
Ruby, 51 bytes

```<code>->z{z.map{z[1],z[3],z[5],z[4],z[2],z[0]=z+[""]}*$/}
</code>```

Instead of iterating over the numbers 0..5 as below, we repeat 6 times by iterating over the elements of z. In normal usage such as  (0..5).map{|i|puts i} the code {} reads the elements iterated over. In this case the permutations done by the code inside the {} do not read the elements iterated over, so we can iterate over the elements of z without this interfering with the permutations.

Ruby, 56 bytes

Takes a 6 element array as a parameter

```<code>->z{(0..5).map{z[1],z[3],z[5],z[4],z[2],z[0]=z+[""]}*$/}
</code>```

alternate version taking 6 parameters

```<code>->a,b,c,d,e,f{(0..5).map{b,d,f,e,c,a=a,b,c,d,e,f,""}*$/}
</code>```

With each iteration of map we permute z. The original version plus a "" to represent a break between stanzas becomes the output of the map (this seventh array element is not needed by the assignment so is ignored). *$/ converts the arrays to a string, joining everything together with newlines.

Title: Blueprint a sestina

Body:
Ruby, 51 bytes

->z{z.map{z[1],z[3],z[5],z[4],z[2],z[0]=z+[""]}*$/}

Instead of iterating over the numbers 0..5 as below, we repeat 6 times by iterating over the elements of z. In normal usage such as  (0..5).map{|i|puts i} the code {} reads the elements iterated over. In this case the permutations done by the code inside the {} do not read the elements iterated over, so we can iterate over the elements of z without this interfering with the permutations.

Ruby, 56 bytes

Takes a 6 element array as a parameter

->z{(0..5).map{z[1],z[3],z[5],z[4],z[2],z[0]=z+[""]}*$/}

alternate version taking 6 parameters

->a,b,c,d,e,f{(0..5).map{b,d,f,e,c,a=a,b,c,d,e,f,""}*$/}

With each iteration of map we permute z. The original version plus a "" to represent a break between stanzas becomes the output of the map (this seventh array element is not needed by the assignment so is ignored). *$/ converts the arrays to a string, joining everything together with newlines.


答:
JavaScript, 147 bytes, jrich

```<code>+function e(){window[(w=[``>``]+``)[i=9/9]+w[i+i]+"ert"]('+'+e+'()');"  +./;;;;;=======>[]````````ccddddddeeeeeeeefiinnnnoooooorrrrrrrsttuwwx{}"}()
</code>```

With all those extra chars, this is definitely not the intended solution :-)

Title: Quine Anagrams! (Robbers' Thread)

Body:
This is the robbers' thread. For the cops' thread, click here.

Cops' Task

For the cops' thread, click here.

Robbers' Task

Find an uncracked submission on the cops' thread. (A submission may only be cracked once.)

Unscramble the code to find a working quine.

Post an answer on the robbers' thread. Include the language, the byte count, the user who posted the scrambled code, a link to that answer, and the unscrambled code.

Here is an example of a robber submission:

Python, 29 bytes, Oliver

```<code>_='_=%r;print _%%_';print _%_
</code>```

Scoring

The user with the most cracks will be the winner of this section.

Body:
JavaScript, 147 bytes, jrich

+function e(){window[(w=[``>``]+``)[i=9/9]+w[i+i]+"ert"]('+'+e+'()');"  +./;;;;;=======>[]````````ccddddddeeeeeeeefiinnnnoooooorrrrrrrsttuwwx{}"}()

With all those extra chars, this is definitely not the intended solution :-)


答:
Python, <s>72</s> 64 bytes

```<code>i,n=input(),'\n';exec"print n.join(i)+n;i=map(i.pop,[-1,0]*3);"*6
</code>```

Takes input through STDIN as a comma separated array of 6 strings and outputs to STDOUT in the format described in the post with an additional trailing newline.

Try It Online! (Ideone)

Also, I am not sure if this is okay to do, but here is a shorter answer in the form of an anonymous lambda function at 59 bytes that takes in input in the same format as the above answer, and outputs the program needed to generate the correct output:

```<code>lambda i,n='\n':"print n.join(i)+n;i=map(i.pop,[-1,0]*3);"*6
</code>```

Therefore it must be called in the format exec(<Function Name>(<Array>)). Again, I am not sure if this is okay to do, so I am adding this as an extra, separate, non-competing answer until someone (maybe even OP) can hopefully clarify if this is okay or not, which I would really appreciate.

Title: Blueprint a sestina

Body:
Python, <s>72</s> 64 bytes

i,n=input(),'\n';exec"print n.join(i)+n;i=map(i.pop,[-1,0]*3);"*6

Takes input through STDIN as a comma separated array of 6 strings and outputs to STDOUT in the format described in the post with an additional trailing newline.

Try It Online! (Ideone)

Also, I am not sure if this is okay to do, but here is a shorter answer in the form of an anonymous lambda function at 59 bytes that takes in input in the same format as the above answer, and outputs the program needed to generate the correct output:

lambda i,n='\n':"print n.join(i)+n;i=map(i.pop,[-1,0]*3);"*6

Therefore it must be called in the format exec(<Function Name>(<Array>)). Again, I am not sure if this is okay to do, so I am adding this as an extra, separate, non-competing answer until someone (maybe even OP) can hopefully clarify if this is okay or not, which I would really appreciate.


答:
FurryScript, 199 bytes, Safe!

```<code>UT  TTEDU DT   T U T D   ES DGT GEL L   GL
-<<<<<<+++++++[[[[#BESTQUINEEVER!#BESTQUINEEVER!#BESTQUINEEVER!#BESTQUINEEVER!#BESTQUINEEVER!#]]]]+++++++>>>>>>-

X   XG WPW   SS  X  PW S US WWTLWP  XS  PE
</code>```

Should be fairly easy to crack.

Unscrambled Code

```<code>BESTQUINE[ DUP LT +SW +GT +< BESTQUINE#> ]
EVER![ DUP EX+ SW EX- LT +SW +GT +< EVER!#> ]
<BESTQUINE[ DUP LT +SW +GT +< BESTQUINE#> ]> BESTQUINE#
<EVER![ DUP EX+ SW EX- LT +SW +GT +< EVER!#> ]> EVER!#
</code>```

Just the regular quine, but with two subroutines and some more code to swap the strings.

Title: Quine Anagrams! (Cops' Thread)

Body:
This is the cops' thread. For the robbers' thread, click here.

Cops' Task

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

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

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

Your program may not print to STDERR.

Here is an example of a cop submission:

Python, 29 bytes

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

Robbers' Task

For the robbers' thread, click here.

Safe Submissions

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

Scoring

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

Leaderboard

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

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

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

If your submission gets cracked, please format like this:

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

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

If your submission is safe, format like this:

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

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

```

Body:
FurryScript, 199 bytes, Safe!

UT  TTEDU DT   T U T D   ES DGT GEL L   GL
-<<<<<<+++++++[[[[#BESTQUINEEVER!#BESTQUINEEVER!#BESTQUINEEVER!#BESTQUINEEVER!#BESTQUINEEVER!#]]]]+++++++>>>>>>-

X   XG WPW   SS  X  PW S US WWTLWP  XS  PE

Should be fairly easy to crack.

Unscrambled Code

BESTQUINE[ DUP LT +SW +GT +< BESTQUINE#> ]
EVER![ DUP EX+ SW EX- LT +SW +GT +< EVER!#> ]
<BESTQUINE[ DUP LT +SW +GT +< BESTQUINE#> ]> BESTQUINE#
<EVER![ DUP EX+ SW EX- LT +SW +GT +< EVER!#> ]> EVER!#

Just the regular quine, but with two subroutines and some more code to swap the strings.


答:
Pyth, 38 bytes, Safe

Not quite golfed, but works.

```<code>````::""@@@@++++22ggKKKKKKKKNNNNZZZZ
```

<p>Unsorted version:</p>

```K"K++@KZ:`K@`NZNgK2"++@KZ:`K@`NZNgK2
```

Title: Quine Anagrams! (Cops' Thread)

Body:
Pyth, 38 bytes, Safe

Not quite golfed, but works.

````::""@@@@++++22ggKKKKKKKKNNNNZZZZ

Unsorted version:

K"K++@KZ:`K@`NZNgK2"++@KZ:`K@`NZNgK2


答:
Scala, 97 + 68 = 165 bytes

Encryption (97 bytes):

```<code>s=>s.map(_+((math.random*65535).toInt<<8)).iterator.grouped(math.sqrt(s.size)toInt)withPadding 32
</code>```

Takes a String and retuns an Iterator of Sequences of Integers.

Decryption (68 bytes):

```<code>a=>" +$".r.replaceAllIn(a.flatten.map(h=>(h&0xFF)toChar)mkString,"")
</code>```

Takes an Iterator of Sequences of Integers and returns a string.

Explanation:

```<code>s=>                         //define an anonymous function
  s.map(                      //map each char of the string
    _+(                         //to the ascii value plus
      (math.random*65535).toInt)  //a random integer between 0 and 65535
      <<8                         //shifted 8 bits to the left
    )
  )
  .iterator                     //create an iterator
  .grouped(                     //group them in groups of size...
    math.sqrt(s.size)toInt        //sqrt of the size of the input, rounded up
  )withPadding 32               //pad with spaces to make a square
</code>```

.

```<code>a=>
  " +$"              //take this string
  .r                 //parse it as a regex
  .replaceAllIn(     //replace every occurence of the regex in...
    a.flatten          //a flattened
    .map(h=>           //each element mapped
      (h&0xFF)toChar)    //to the character of the lower 8 bits
    mkString,          //joined to a string
    ""               //with an empty string
  )
</code>```

Title: Steganographic Squares

Body:
Steganographic Squares

Your job is to take in a string, and generate an NxN image that represents this string. You must also write the algorithm that takes in the image and turns it back into a string as well. The scoring will be will include the byte count of both algorithms:

"Encryption" Algorithm + "Decryption" Algorithm.

You should post each separately, with byte-counts for both the encryption and decryption algorithms displayed individually.

Example Algorithm

For instance, here's the "Programming Puzzles and Code Golf" using a simple ASCII based steganographic algorithm in the Blue channel:

```<code>#2e7250,#6ea972,#04eb6f,#0fc767,#74ab72,#ee6161
#b73b6d,#1aae6d,#f37169,#bda56e,#1fe367,#e99620
#706450,#0d3575,#146b7a,#4ea47a,#2a856c,#95d065
#3f2d73,#cef720,#bab661,#d1b86e,#f22564,#12b820
#0f3d43,#c86e6f,#1ee864,#a66565,#247c20,#c3bb47
#0e296f,#89d46c,#585b66,#c08f20,#455c20,#136f20
</code>```

Actual Image (  )

You can see the blue channel simply holds the ascii values for this image:

```<code>50 =  80(P) 72 = 114(r) 6f = 111(o) 67 = 103(g) 72 = 114(r) 61 =  97(a)
6d = 109(m) 6d = 109(m) 69 = 105(i) 6e = 110(n) 67 = 103(g) 20 =  32( )
50 =  80(P) 75 = 117(u) 7a = 122(z) 7a = 122(z) 6c = 108(l) 65 = 101(e)
73 = 115(s) 20 =  32( ) 61 =  97(a) 6e = 110(n) 64 = 100(d) 20 =  32( )
43 =  67(C) 6f = 111(o) 64 = 100(d) 65 = 101(e) 20 =  32( ) 47 =  71(G)
6f = 111(o) 6c = 108(l) 66 = 102(f) 20 =  32( ) 20 =  32( ) 20 =  32( )
</code>```

While the rest of the channels hold randomly generated values to "spice up" the variety of colors in the image. When pulling the message back out of the image, we can just simply ignore the other channel values, and pull the hex bit in the blue channel, reconstructing the string:

```<code>"Programming Puzzles and Code Golf"
</code>```

Notice the spaces that were used to pad the string in the square are not included in the final decrypted output. While you must pad the string in the image, you may assume that the input string will not end with spaces.

Rules

You must encode 1 character per pixel, the channel chosen to encode the char is arbitrary.

The channels of the other RGB colors must be randomized, other than the one you're choosing to encode the string into; this means your final non-encoded channels would need to be between 0x0000-0xFFFF (randomly chosen).

Expressing the final result as a 2D array of RGB color values is fine 0x000000-0xFFFFFF, no need to use image creation unless you want to have fun with it or if it's less bytes. If you choose to output as hex strings, prefix the hex string with # E.G. #FFFFFF or #05AB1E. You may separate with tabs, commas, or anything else that would be horizontally sensible, but it must maintain the square pattern; in other words, you must use appropriate newline separation.

The output must be in a square, and the string must be padded with spaces at the end to accomodate this. This means that N≈SQRT(Input#Length()). If the input length is not a perfect square, you should round up on N and pad with spaces.

As stated previously, if you are padding with spaces in the image, you must not include the padded characters in the final "decrypted" output.

You can assume that:

The input string will not end with spaces.

The input string will only use printable ASCII characters.

This is code-golf, lowest byte count wins.

Body:
Scala, 97 + 68 = 165 bytes

Encryption (97 bytes):

s=>s.map(_+((math.random*65535).toInt<<8)).iterator.grouped(math.sqrt(s.size)toInt)withPadding 32

Takes a String and retuns an Iterator of Sequences of Integers.

Decryption (68 bytes):

a=>" +$".r.replaceAllIn(a.flatten.map(h=>(h&0xFF)toChar)mkString,"")

Takes an Iterator of Sequences of Integers and returns a string.

Explanation:

s=>                         //define an anonymous function
  s.map(                      //map each char of the string
    _+(                         //to the ascii value plus
      (math.random*65535).toInt)  //a random integer between 0 and 65535
      <<8                         //shifted 8 bits to the left
    )
  )
  .iterator                     //create an iterator
  .grouped(                     //group them in groups of size...
    math.sqrt(s.size)toInt        //sqrt of the size of the input, rounded up
  )withPadding 32               //pad with spaces to make a square

.

a=>
  " +$"              //take this string
  .r                 //parse it as a regex
  .replaceAllIn(     //replace every occurence of the regex in...
    a.flatten          //a flattened
    .map(h=>           //each element mapped
      (h&0xFF)toChar)    //to the character of the lower 8 bits
    mkString,          //joined to a string
    ""               //with an empty string
  )


问:
Identify the IP address
Identify whether an IP address is internal, global, link-local, or reserved.

Input should be an IPv4 address in decimal octets separated by periods.

Output should be 0 for link-local (RFC 3927), 1 for internal (RFC 1918), 2 for global IPs (Internet), and 3 for otherwise reserved addresses.

All these address types are described in RFC 5735:

Global and Other Specialized Address Blocks

0.0.0.0/8 - Addresses in this block refer to source hosts on "this"    network.  Address 0.0.0.0/32 may be used as a source address for this
host on this network; other addresses within 0.0.0.0/8 may be used to
refer to specified hosts on this network ([RFC1122], Section
3.2.1.3).

10.0.0.0/8 - This block is set aside for use in private networks.    Its intended use is documented in [RFC1918].  As described in that

RFC, addresses within this block do not legitimately appear on the

public Internet.  These addresses can be used without any

coordination with IANA or an Internet registry.

127.0.0.0/8 - This block is assigned for use as the Internet host    loopback address.  A datagram sent by a higher-level protocol to an

address anywhere within this block loops back inside the host.  This

is ordinarily implemented using only 127.0.0.1/32 for loopback.  As

described in [RFC1122], Section 3.2.1.3, addresses within the entire
127.0.0.0/8 block do not legitimately appear on any network anywhere.

169.254.0.0/16 - This is the "link local" block.  As described in    [RFC3927], it is allocated for communication between hosts on a

single link.  Hosts obtain these addresses by auto-configuration,

such as when a DHCP server cannot be found.

172.16.0.0/12 - This block is set aside for use in private networks.    Its intended use is documented in [RFC1918].  As
described in that    RFC, addresses within this block do not
legitimately appear on the    public Internet.  These addresses can be
used without any    coordination with IANA or an Internet registry.

192.0.0.0/24 - This block is reserved for IETF protocol assignments.    At the time of writing this document, there are no
current    assignments.  Allocation policy for future assignments is
given in    [RFC5736].

192.0.2.0/24 - This block is assigned as "TEST-NET-1" for use in    documentation and example code.  It is often used in conjunction with
domain names example.com or example.net in vendor and protocol

documentation.  As described in [RFC5737], addresses within this

block do not legitimately appear on the public Internet and can be

used without any coordination with IANA or an Internet registry.  See
[RFC1166].

192.88.99.0/24 - This block is allocated for use as 6to4 relay    anycast addresses, in [RFC3068].  In contrast with previously

described blocks, packets destined to addresses from this block do

appear in the public Internet.  [RFC3068], Section 7, describes

operational practices to prevent the malicious use of this block in

routing protocols.

192.168.0.0/16 - This block is set aside for use in private networks.    Its intended use is documented in [RFC1918].  As
described in that    RFC, addresses within this block do not
legitimately appear on the    public Internet.  These addresses can be
used without any    coordination with IANA or an Internet registry.

198.18.0.0/15 - This block has been allocated for use in benchmark    tests of network interconnect devices.  [RFC2544] explains that this

range was assigned to minimize the chance of conflict in case a

testing device were to be accidentally connected to part of the

Internet.  Packets with source addresses from this range are not

meant to be forwarded across the Internet.

198.51.100.0/24 - This block is assigned as "TEST-NET-2" for use in    documentation and example code.  It is often used in conjunction with
domain names example.com or example.net in vendor and protocol

documentation.  As described in [RFC5737], addresses within this

block do not legitimately appear on the public Internet and can be

used without any coordination with IANA or an Internet registry.

203.0.113.0/24 - This block is assigned as "TEST-NET-3" for use in    documentation and example code.  It is often used in conjunction with
domain names example.com or example.net in vendor and protocol

documentation.  As described in [RFC5737], addresses within this

block do not legitimately appear on the public Internet and can be

used without any coordination with IANA or an Internet registry.

224.0.0.0/4 - This block, formerly known as the Class D address    space, is allocated for use in IPv4 multicast address assignments.

The IANA guidelines for assignments from this space are described in

[RFC3171].

240.0.0.0/4 - This block, formerly known as the Class E address    space, is reserved for future use; see [RFC1112], Section 4.

The one exception to this is the "limited broadcast" destination

address 255.255.255.255.  As described in [RFC0919] and [RFC0922],

packets with this destination address are not forwarded at the IP

layer.

4.  Summary Table

```<code>Address Block       Present Use                Reference
0.0.0.0/8           "This" Network             RFC 1122, Section 3.2.1.3
10.0.0.0/8          Private-Use Networks       RFC 1918
127.0.0.0/8         Loopback                   RFC 1122, Section 3.2.1.3
169.254.0.0/16      Link Local                 RFC 3927
172.16.0.0/12       Private-Use Networks       RFC 1918
192.0.0.0/24        IETF Protocol Assignments  RFC 5736
192.0.2.0/24        TEST-NET-1                 RFC 5737
192.88.99.0/24      6to4 Relay Anycast         RFC 3068
192.168.0.0/16      Private-Use Networks       RFC 1918
198.18.0.0/15       Network Interconnect
                    Device Benchmark Testing   RFC 2544
198.51.100.0/24     TEST-NET-2                 RFC 5737
203.0.113.0/24      TEST-NET-3                 RFC 5737
224.0.0.0/4         Multicast                  RFC 3171
240.0.0.0/4         Reserved for Future Use    RFC 1112, Section 4
255.255.255.255/32  Limited Broadcast          RFC 919, Section 7
                                               RFC 922, Section 7
</code>```

Rules

Standard loopholes apply.

This is code-golf, shortest answer wins.

Title: Identify the IP address

Body:
ES6 (Javascript), 204, 200, 182, 178 bytes

EDIT: Rewritten hex padding code, removed extra parenthesis, -4 bytes

EDIT: RegExp cleanup, streamline the result extraction, shorten the hex conversion code

EDIT: Refactored result extraction to bring it down to 200 bytes

Note, this should be pretty easy to shorten even further, by compressing the RegExp (as I never really bothered to do this)

Golfed

a=>/(^(?:00|7f|c0(?:5863|0{3}[02])|c6(?:1[23]|3364)|cb0071|e|f))|(^a9fe)|(^0a|^ac1|^c0a8)|./.exec(a.replace(/\d+./g,o=>(o|256).toString(16).slice(1))).reverse().findIndex(a=>a)^1

Explanation

IP addresses are shorter to write and easier to match, when converted to hexadecimal form, as CIDR masks tend to end on the 4 bit boundaries (with an exception of 198.18.0.0/15).

E.g.

0A000000-0AFFFFFF //10.0.0.0/8
AC100000-AC1FFFFF //172.16.0.0/12
C0A80000-C0A8FFFF //192.168.0.0/16

can be matched as

/^0a|^ac1|^c0a8/

Test

I=a=>/(^(?:00|7f|c0(?:5863|0{3}[02])|c6(?:1[23]|3364)|cb0071|e|f))|(^a9fe)|(^0a|^ac1|^c0a8)|./.exec(a.replace(/\d+./g,o=>(o|256).toString(16).slice(1))).reverse().findIndex(a=>a)^1;

T=(i,o)=>{
  block=I(i);
  console.log(i,(block==o)?"OK":"NOT OK");
}

T("0.0.0.0",3)
T("10.0.0.0",1)
T("11.0.0.0",2)
T("127.0.0.0",3)
T("169.254.0.0",0)
T("169.253.0.0",2)
T("172.16.0.0",1)
T("172.31.0.0",1)
T("172.32.0.0",2)
T("192.0.0.0",3)
T("192.0.2.0",3)
T("192.88.99.0",3)
T("192.168.0.0",1)
T("192.167.0.0",2)
T("198.18.0.0",3)
T("198.51.100.0",3)
T("203.0.113.0",3)
T("224.0.0.0",3)
T("239.255.255.255",3)
T("240.0.0.0",3)
T("255.255.255.255",3)
T("241.0.0.1",3)
T("151.101.192.71",2)


答:
Pyth, 3 bytes, 10 numbers (Cracked)

I think it's a very simple one, and will easily get cracked.

So, it goes like this: (hidden characters: _)

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

Title: Code ladder, Cops

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

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

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

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

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

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

Example post:

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

MyLang, 9 bytes, 8 numbers

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

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

Leaderboard

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

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Body:
Pyth, 3 bytes, 10 numbers (Cracked)

I think it's a very simple one, and will easily get cracked.

So, it goes like this: (hidden characters: _)

__Q


答:
Octave, 25 bytes, 10 numbers, by Luis Mendo

```<code>mean(repmat(1,ones(1,1)))
mean(repmat(2,ones(1,1)))
mean(repmat(3,ones(1,1)))
mean(repmat(4,ones(1,1)))
mean(repmat(5,ones(1,1)))
mean(repmat(6,ones(1,1)))
mean(repmat(7,ones(1,1)))
mean(repmat(8,ones(1,1)))
mean(repmat(9,ones(1,1)))
</code>```

Title: Code ladder, Robbers

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

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

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

Example post:

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

Original code:

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

Code that produces 1 - 8:

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

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

Body:
Octave, 25 bytes, 10 numbers, by Luis Mendo

mean(repmat(1,ones(1,1)))
mean(repmat(2,ones(1,1)))
mean(repmat(3,ones(1,1)))
mean(repmat(4,ones(1,1)))
mean(repmat(5,ones(1,1)))
mean(repmat(6,ones(1,1)))
mean(repmat(7,ones(1,1)))
mean(repmat(8,ones(1,1)))
mean(repmat(9,ones(1,1)))


答:
아희(Aheui), 19 bytes, 10 numbers, by JHM

Original code:

```<code>봃法희
반자뭉
</code>```

Modified:

```<code>2
봃法희
반반뭉
3
봃法희
반밬뭉
4
봃法희
반밭뭉
5
봃法희
반발뭉
6
봃法희
반타뭉
7
봃法희
반밝뭉
8
봃法희
반밣뭉
9
봃法희
반밢뭉
10
봃法희
반다뭉
</code>```

Title: Code ladder, Robbers

Body:
아희(Aheui), 19 bytes, 10 numbers, by JHM

Original code:

봃法희
반자뭉

Modified:

2
봃法희
반반뭉
3
봃法희
반밬뭉
4
봃法희
반밭뭉
5
봃法희
반발뭉
6
봃法희
반타뭉
7
봃法희
반밝뭉
8
봃法희
반밣뭉
9
봃法희
반밢뭉
10
봃法희
반다뭉


答:
Acc!!, 10 bytes, 9 numbers, by DLosc

Original code :

```<code>Write 49+_
</code>```

To produce the numbers 1 to 9 :

```<code>Write 49+_
Write 49+1
Write 49+2
Write 49+3
Write 49+4
Write 49+5
Write 49+6
Write 49+7
Write 49+8
</code>```

49 is the ascii code of 1. _ contains 0 by default (so 49+_ = 1). And Write prints the character corresponding to the ascii code of its argument. Pretty straight forward.

Title: Code ladder, Robbers

Body:
Acc!!, 10 bytes, 9 numbers, by DLosc

Original code :

Write 49+_

To produce the numbers 1 to 9 :

Write 49+_
Write 49+1
Write 49+2
Write 49+3
Write 49+4
Write 49+5
Write 49+6
Write 49+7
Write 49+8

49 is the ascii code of 1. _ contains 0 by default (so 49+_ = 1). And Write prints the character corresponding to the ascii code of its argument. Pretty straight forward.


答:
Pyth, 3 bytes, 10 numbers, by Yotam Salmon

Original code was __Q, with_ unknown.

1.Q: Implicit print 1, throw error when trying to evaluate empty input.
 Same answer for 2-9 (with the number 1 replaced by 2-9), and the code T.Q for 10 (since T is initialized to 10).

Title: Code ladder, Robbers


答:
Octave, 17 bytes, 10 numbers, Cracked

```<code>_i_(__i__(2_5_))
</code>```

Unrevealed characters are marked with _.

Intended solution:

```<code>
    fix(asind(2/59))
    fix(asind(3/59))
    fix(asind(4/59))
    fix(asind(5/59))
    fix(asind(6/59))
    fix(asind(7/59))
    fix(asind(8/59))
    fix(asind(9/59))
    fix(asind(9/55))
    fix(asind(9/50))```

Title: Code ladder, Cops

Body:
Octave, 17 bytes, 10 numbers, Cracked

_i_(__i__(2_5_))

Unrevealed characters are marked with _.

Intended solution:

    fix(asind(2/59))
    fix(asind(3/59))
    fix(asind(4/59))
    fix(asind(5/59))
    fix(asind(6/59))
    fix(asind(7/59))
    fix(asind(8/59))
    fix(asind(9/59))
    fix(asind(9/55))
    fix(asind(9/50))


答:
Octave, 24 bytes, 9 numbers, cracked

```<code>_a__repmat(__one___,__)_
</code>```

_ is a hidden character.

(Inspired by @LuisMendo's challenge.)

Title: Code ladder, Cops

Body:
Octave, 24 bytes, 9 numbers, cracked

_a__repmat(__one___,__)_

_ is a hidden character.

(Inspired by @LuisMendo's challenge.)


答:
Octave, 24 bytes, 9 numbers, by flawr

```<code>max(repmat(1,ones(),1))%
max(repmat(2,ones(),1))%
max(repmat(3,ones(),1))%
max(repmat(4,ones(),1))%
max(repmat(5,ones(),1))%
max(repmat(6,ones(),1))%
max(repmat(7,ones(),1))%
max(repmat(8,ones(),1))%
max(repmat(9,ones(),1))%
</code>```

Octave, 24 bytes <s>9</s> 10 numbers

Note: This crack is for the first version of the cop post (posted the wrong snippet), with the revealed code looking like this: ___a__repmat(__one__),__). The correct version is above.

Original code:

```<code>+mean(repmat(1,ones(),1))
</code>```

Modified versions that print 2-10

```<code>1+mean(repmat(1,ones(),1))
2+mean(repmat(1,ones(),1))
3+mean(repmat(1,ones(),1))
4+mean(repmat(1,ones(),1))
5+mean(repmat(1,ones(),1))
6+mean(repmat(1,ones(),1))
7+mean(repmat(1,ones(),1))
8+mean(repmat(1,ones(),1))
9+mean(repmat(1,ones(),1))
</code>```

Title: Code ladder, Robbers

Body:
Octave, 24 bytes, 9 numbers, by flawr

max(repmat(1,ones(),1))%
max(repmat(2,ones(),1))%
max(repmat(3,ones(),1))%
max(repmat(4,ones(),1))%
max(repmat(5,ones(),1))%
max(repmat(6,ones(),1))%
max(repmat(7,ones(),1))%
max(repmat(8,ones(),1))%
max(repmat(9,ones(),1))%

Octave, 24 bytes <s>9</s> 10 numbers

Note: This crack is for the first version of the cop post (posted the wrong snippet), with the revealed code looking like this: ___a__repmat(__one__),__). The correct version is above.

Original code:

+mean(repmat(1,ones(),1))

Modified versions that print 2-10

1+mean(repmat(1,ones(),1))
2+mean(repmat(1,ones(),1))
3+mean(repmat(1,ones(),1))
4+mean(repmat(1,ones(),1))
5+mean(repmat(1,ones(),1))
6+mean(repmat(1,ones(),1))
7+mean(repmat(1,ones(),1))
8+mean(repmat(1,ones(),1))
9+mean(repmat(1,ones(),1))


问:
Add weight to one side of a see-saw to balance it

Balancing Act

A see-saw (supposedly from the French 'ci-ça', meaning 'this-that') forms a third of the holy trinity of playground equipment, along with the similarly ubiquitous slide and swing. A see-saw is in perfect balance if, and only if, the sum of the moments on each side are equivalent. A see-saw can therefore be balanced by adding a specific quantity of weight to the side with the lower moment sum; achieving this is your goal for this challenge.

Challenge

Your challenge is to take a depiction of a see-saw as input and output it again, with weight added to one end of the see-saw to balance it.

Input

Your program must take, in any reasonable format, an ASCII see-saw such as the following:

```<code>100             100
-------------------
         ^
</code>```

The first line contains two numbers, each representing weights on the see-saw. Exactly one weight is present on each side, each acting on the very end of its side of the plank. Weights are guaranteed to be integers, and always align with their corresponding end of the plank. These numbers will never overlap the fulcrum (^).

The second line represents the 'plank' of the see-saw. Each dash (-) represents an equal length to each other dash, with the sole exception of the dash directly over the fulcrum (^), which has no length.

The third line represents the fulcrum of the see-saw. This fulcrum is marked by the only character that is not a space on this line, a circumflex ('^'). The fulcrum can be positioned anywhere along the length of the plank in a valid input so long as enough space is left so that the numbers representing weights do not overlap the fulcrum in either the input or the output.

The input is guaranteed to have three lines, and have no white-space prior to or after the characters that constitute the see-saw (excepting, of course, the third line, which requires it).

Output

For output, the same see-saw depiction should be printed to stdout, but with one (and only one) of the weights replaced with a larger weight, so as to balance the see-saw. Inputs are guaranteed to make this possible using integers alone. Therefore, weights must be shown without decimal points or any other similar notations. If your language does not use stdout you should go by community / meta consensus on output. Trailing newlines are fine but any other changes to the depiction format are probably not OK.

Exemplification

Test Inputs and Corresponding Outputs

Input 1

```<code>12                22
--------------------
             ^
</code>```

Output 1

```<code>12                26
--------------------
             ^
</code>```

Input 2

```<code>42       42
-----------
     ^
</code>```

Output 2

```<code>42       42
-----------
     ^
</code>```

Input 3

```<code>3             16
----------------
        ^
</code>```

Output 3

```<code>14            16
----------------
        ^
</code>```

Input 4

```<code>1                56
-------------------
    ^
</code>```

Output 4

```<code>196              56
-------------------
    ^
</code>```

Reference Implementation - Python 3

```<code># Takes a list of strings as input
def balance_seesaw(lines):
    weights = [int(w.strip()) for w in lines[0].split()]

    length  = len(lines[1])
    pivot   = lines[2].find("^")
    left_length    = pivot
    right_length   = length - 1 - pivot

    left_torque  = weights[0] * left_length
    right_torque = weights[1] * right_length

    if left_torque > right_torque:
        weights[1] = left_torque // right_length
    elif right_torque > left_torque:
        weights[0] = right_torque // left_length

    weights = [str(w) for w in weights]

    string_gap = " " * (length - sum(len(w) for w in weights))
    lines[0] = weights[0] + string_gap + weights[1]

    print("\n".join(lines))

balance_seesaw(["1                56",
                "-------------------",
                "    ^              "])
</code>```

Rules

This is code-golf, so the shortest code wins counted in bytes. Check meta if counting bytes is awkward in your language.

Standard rules/loopholes apply.

Input must be taken in a reasonable format. A non-exhaustive list of appropriate formats are given as follows:

A single string with lines separated by newline characters

A list of strings, each string represented a line

A 2D Array or Matrix of characters

Related Challenges

Balance a set of weights on a see-saw - Proposed Aug 2015 by samgak

答:
JavaScript (ES6), 136

<s>Probably not working in Chrome,as it uses destructured assignment and default parameters.</s>

Note that the standard JS output method alert is particularly unsuited for the task, because of the proportional font used.

(m,n,o,[p,q]=m.split(/ +/),l=n.length,h=o.indexOf`^`,g=l-h-1,c=p*h<q*g?q*g:p*h)=>alert((c/h+o).slice(0,h)+(o+c/g).slice(h-l)+`
${n}
`+o)
```
<p><em>Less golfed</em></p>
<pre class="lang-js prettyprint-override"><code>( m,n,o, // input parameters, 3 strings
  // default parameters used as local variables
  [p,q] = m.split(/ +/), // left and right weight
  l = n.length, // bar length
  h = o.indexOf`^`, // left length
  g = l-h-1, // right length
  // p*h left torque
  // q*g right torque
  c = p*h<q*g ? q*g : p*h // max torque
) => alert( (c/h+o).slice(0,h)+(o+c/g).slice(h-l) // o has enough spaces to pad left and right
     +`\n${n}\n`+o )
</code>```

Test

F=
(m,n,o,[p,q]=m.split(/ +/),l=n.length,h=o.indexOf`^`,g=l-h-1,c=p*h<q*g?q*g:p*h)=>alert((c/h+o).slice(0,h)+(o+c/g).slice(h-l)+`
${n}
`+o)

function go()
{
  var [a,b,c]=I.value.split('\n')
  if(a.length!=b.length || a.length < c.length)
    alert('The strings are not of the same length')
  else
  {
    if (a.length > c.length)
      c = c+' '.repeat(a.length-c-length)
    F(a,b,c)
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><textarea id=I>3             16
----------------
        ^      </textarea>
<button onclick='go()'>go</button></code>```

Body:
JavaScript (ES6), 136

<s>Probably not working in Chrome,as it uses destructured assignment and default parameters.</s>

Note that the standard JS output method alert is particularly unsuited for the task, because of the proportional font used.

(m,n,o,[p,q]=m.split(/ +/),l=n.length,h=o.indexOf`^`,g=l-h-1,c=p*h<q*g?q*g:p*h)=>alert((c/h+o).slice(0,h)+(o+c/g).slice(h-l)+`
${n}
`+o)

Less golfed

( m,n,o, // input parameters, 3 strings
  // default parameters used as local variables
  [p,q] = m.split(/ +/), // left and right weight
  l = n.length, // bar length
  h = o.indexOf`^`, // left length
  g = l-h-1, // right length
  // p*h left torque
  // q*g right torque
  c = p*h<q*g ? q*g : p*h // max torque
) => alert( (c/h+o).slice(0,h)+(o+c/g).slice(h-l) // o has enough spaces to pad left and right
     +`\n${n}\n`+o )

Test

F=
(m,n,o,[p,q]=m.split(/ +/),l=n.length,h=o.indexOf`^`,g=l-h-1,c=p*h<q*g?q*g:p*h)=>alert((c/h+o).slice(0,h)+(o+c/g).slice(h-l)+`
${n}
`+o)

function go()
{
  var [a,b,c]=I.value.split('\n')
  if(a.length!=b.length || a.length < c.length)
    alert('The strings are not of the same length')
  else
  {
    if (a.length > c.length)
      c = c+' '.repeat(a.length-c-length)
    F(a,b,c)
  }
}

<textarea id=I>3             16
----------------
        ^      </textarea>
<button onclick='go()'>go</button>


答:
Octave, 21 bytes 9 numbers, cracked

```<code>_a__repmat(_one___,__
</code>```

_ is a hidden character.

My idea:

  a=[repmat(bone,0),9]

Title: Code ladder, Cops

Body:
Octave, 21 bytes 9 numbers, cracked

_a__repmat(_one___,__

_ is a hidden character.

My idea:

  a=[repmat(bone,0),9]


问:
Pairable strings
A string is pairable if it can be split into subtrings, each of which is a string repeated twice consecutively. For example, aabaaababbbaba is pairable as:

```<code>aaba aaba
b b
ba ba
</code>```

Given a non-empty string of a's and b's, output a Truthy value if it's pairable and a Falsey value if it isn't.

Pairable:

```<code>aa
abaaba
bbababbb
aabaaababbbaba
babababa
bbbbbbbbbbbb
aaababbabbabbbababbaabaabaababaaba
aaaabaab
</code>```

Not pairable:

```<code>a
ba
baab
abaabaaba
bbbbbbbbbbbbbbb
baababbabaaaab
aaaaabbaaaaa
</code>```

I encourage you to come up with non-regex-based solutions even when there's already a shorter regex answer in your language. You can mark them as "no regex". By regex, I mean a built-in string pattern matching subsystem.

Leaderboard:

var QUESTION_ID=98252,OVERRIDE_USER=20260;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/98252/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, 58 bytes

f=lambda s,p='':s>''and(f(p)>-(s==p)<f(s))|f(s[1:],p+s[0])
```

This is based on the Dennis's recursive method. The Boolean negation trick is taken from there as well.

The new idea is to recurse over partitions (p,s) of the original string by starting with ('',s) and repeatedly moving the first character of s to be the last character of p. This allows for the parts to be referred to directly without string slicing. But, because the partition starts with p empty, we must be careful to avoid infinite loops of f(s) calling f(s).

Title: Pairable strings

Body:
Python, 58 bytes

f=lambda s,p='':s>''and(f(p)>-(s==p)<f(s))|f(s[1:],p+s[0])

This is based on the Dennis's recursive method. The Boolean negation trick is taken from there as well.

The new idea is to recurse over partitions (p,s) of the original string by starting with ('',s) and repeatedly moving the first character of s to be the last character of p. This allows for the parts to be referred to directly without string slicing. But, because the partition starts with p empty, we must be careful to avoid infinite loops of f(s) calling f(s).


答:
Octave, 21 bytes, 9 numbers, by flawr

I really enjoyed this one... Clever :)

```<code>a='repmat(1one'(1,8)
a='repmat(2one'(1,8)
a='repmat(3one'(1,8)
a='repmat(4one'(1,8)
a='repmat(5one'(1,8)
a='repmat(6one'(1,8)
a='repmat(7one'(1,8)
a='repmat(8one'(1,8)
a='repmat(9one'(1,8)
</code>```

Title: Code ladder, Robbers

Body:
Octave, 21 bytes, 9 numbers, by flawr

I really enjoyed this one... Clever :)

a='repmat(1one'(1,8)
a='repmat(2one'(1,8)
a='repmat(3one'(1,8)
a='repmat(4one'(1,8)
a='repmat(5one'(1,8)
a='repmat(6one'(1,8)
a='repmat(7one'(1,8)
a='repmat(8one'(1,8)
a='repmat(9one'(1,8)


答:
JavaScript, 9 bytes, 10 numbers, Cracked

```<code>alert(__)
</code>```

_ is the hidden character.

Title: Code ladder, Cops

Body:
JavaScript, 9 bytes, 10 numbers, Cracked

alert(__)

_ is the hidden character.


答:
JavaScript, 9 bytes, Hedi

Original code:

```<code>alert(+1)
</code>```

Modifications:

```<code>alert(1+1)   // 2
alert(2+1)   // 3
alert(3+1)   // 4
alert(4+1)   // 5
alert(5+1)   // 6
alert(6+1)   // 7
alert(7+1)   // 8
alert(8+1)   // 9
alert(9+1)   // 10
</code>```

Title: Code ladder, Robbers

Body:
JavaScript, 9 bytes, Hedi

Original code:

alert(+1)

Modifications:

alert(1+1)   // 2
alert(2+1)   // 3
alert(3+1)   // 4
alert(4+1)   // 5
alert(5+1)   // 6
alert(6+1)   // 7
alert(7+1)   // 8
alert(8+1)   // 9
alert(9+1)   // 10


答:
JavaScript, 15 bytes, 10 numbers, cracked

```<code>alert(_+"+____)
</code>```

Another short one, this time with an unfinished string >:-)

Title: Code ladder, Cops

Body:
JavaScript, 15 bytes, 10 numbers, cracked

alert(_+"+____)

Another short one, this time with an unfinished string >:-)


答:
JavaScript, 15 bytes, 10 numbers, ETHProductions

Original code:

```<code>alert( +"+1"+0)  // Prints 1
</code>```

Programs:

```<code>alert( +"+1"+1)  // Prints 2
alert( +"+1"+2)  // Prints 3
alert( +"+1"+3)  // Prints 4
alert( +"+1"+4)  // Prints 5
alert( +"+1"+5)  // Prints 6
alert( +"+1"+6)  // Prints 7
alert( +"+1"+7)  // Prints 8
alert( +"+1"+8)  // Prints 9
alert( +"+1"+9)  // Prints 10
</code>```

Title: Code ladder, Robbers

Body:
JavaScript, 15 bytes, 10 numbers, ETHProductions

Original code:

alert( +"+1"+0)  // Prints 1

Programs:

alert( +"+1"+1)  // Prints 2
alert( +"+1"+2)  // Prints 3
alert( +"+1"+3)  // Prints 4
alert( +"+1"+4)  // Prints 5
alert( +"+1"+5)  // Prints 6
alert( +"+1"+6)  // Prints 7
alert( +"+1"+7)  // Prints 8
alert( +"+1"+8)  // Prints 9
alert( +"+1"+9)  // Prints 10


问:
Solve the Laplace equation

Introduction to Numerical Mathematics

This is the "Hello, World!" of PDEs (Partial Differential Equations). The Laplace or Diffusion Equation appears often in Physics, for example Heat Equation, Deforming, Fluid Dynamics, etc... As real life is 3D but we want to say "Hello, World!" and not sing "99 bottles of beer,..." this task is given in 1D. You may interpret this as a rubber robe tied to a wall on both ends with some force applied to it.

On a \$[0,1]\$ domain, find a function \$u\$ for given source function \$f\$ and boundary values \$u_L\$ and \$u_R\$ such that:

\$-u'' = f\$

\$u(0) = u_L\$

\$u(1) = u_R\$

\$u''\$ denotes the second derivative of \$u\$

This can be solved purely theoretically but your task is it to solve it numerically on a discretized domain \$x\$ for \$N\$ points:

\$x = \{\frac i {N-1} : 0 \le i \le N-1\}\$ or 1-based: \$\{\frac {i-1} {N-1} : 0 \le i \le N-1\}\$

\$h = \frac 1 {N-1}\$ is the spacing

Input

\$f\$ as a function, expression or string

\$u_L\$, \$u_R\$ as floating point values

\$N \ge 2\$ as an integer

Output

Array, List, some sort of separated string of \$u\$ such that \$u_i = u(x_i)\$

Examples

Example 1

Input: \$f = -2\$, \$u_L = u_R = 0\$, \$N = 10\$ (Don't take \$f=-2\$ wrong, it is not a value but a constant function that returns \$-2\$ for all \$x\$. It is like a constant gravity force on our rope.)

Output: [-0.0, -0.09876543209876543, -0.1728395061728395, -0.22222222222222224, -0.24691358024691357, -0.24691358024691357, -0.22222222222222224, -0.1728395061728395, -0.09876543209876547, -0.0]

There exists an easy exact solution: \$u = -x(1-x)\$

Example 2

Input: \$f = 10x\$, \$u_L = 0\$, \$u_R = 1\$, \$N = 15\$ (Here there is a lot of upwind on the right side)

Output: [ 0., 0.1898688, 0.37609329, 0.55502915, 0.72303207, 0.87645773, 1.01166181, 1.125, 1.21282799, 1.27150146, 1.29737609, 1.28680758, 1.2361516, 1.14176385, 1.]

The exact solution for this states: \$u = \frac 1 3(8x-5x^3)\$

Example 3

Input: \$f = \sin(2\pi x)\$, \$u_L = u_R = 1\$, \$N = 20\$ (Someone broke gravity or there is a sort of up- and downwind)

Output: [ 1., 1.0083001, 1.01570075, 1.02139999, 1.0247802, 1.0254751, 1.02340937, 1.01880687, 1.01216636, 1.00420743, 0.99579257, 0.98783364, 0.98119313, 0.97659063, 0.9745249, 0.9752198, 0.97860001, 0.98429925, 0.9916999, 1.]

Here the exact solution is \$u = \frac {\sin(2πx)} {4π^2}+1\$

Example 4

Input: \$f = \exp(x^2)\$, \$u_L = u_R = 0\$, \$N=30\$

Output:
[ 0.          0.02021032  0.03923016  0.05705528  0.07367854  0.0890899 0.10327633  0.11622169  0.12790665  0.13830853  0.14740113  0.15515453 0.16153488  0.1665041   0.17001962  0.172034    0.17249459  0.17134303 0.16851482  0.1639387   0.15753606  0.1492202   0.13889553  0.12645668 0.11178744  0.09475961  0.07523169  0.05304738  0.02803389  0.        ]

Note the slight asymmetry

FDM

One possible method to solve this is the Finite Difference Method:

Rewrite \$-u_i'' = f_i\$ as \$\frac {-u_{i-1} + 2u_i - u_{i+1}} {h^2} = f_i\$, which equals \$-u_{i-1} + 2u_i - u_{i+1} = h^2 f_i\$

Setup the equations:

$$
u_0 = u_L \\
\frac {-u_0 + 2u_1 - u_2} {h^2} = f_1 \\
\frac {-u_1 + 2u_2 - u_3} {h^2} = f_2 \\
\dots = \dots \\
\frac {-u_{n-3} + 2u_{n-2} - u_{n-1}} {h^2} = f_{n-2} \\
u_{n-1} = u_R
$$

Which are equal to a matrix-vector equation:

$$
\begin{pmatrix}
 1 & & & & & & \\
-1 & 2 & -1 & & & & \\
 & -1 & 2& -1& & & \\
 & & \ddots & \ddots & \ddots & & \\
 & & & -1 & 2 & -1 & \\
 & & & & -1 & 2 & -1 \\
 & & & & & & 1
\end{pmatrix}
\begin{pmatrix}
u_0 \\ u_1 \\ u_2 \\ \vdots \\ u_{n-3} \\ u_{n-2} \\ u_{n-1}
\end{pmatrix}
=
\begin{pmatrix}
u_L \\ h^2 f_1 \\ h^2 f_2 \\ \vdots \\ h^2 f_{n-3} \\ h^2 f_{n-2} \\ u_R
\end{pmatrix}
$$

Solve this equation and output the \$u_i\$

One implementation of this for demonstration in Python:

```<code>import matplotlib.pyplot as plt
import numpy as np
def laplace(f, uL, uR, N):
 h = 1./(N-1)
 x = [i*h for i in range(N)]

 A = np.zeros((N,N))
 b = np.zeros((N,))

 A[0,0] = 1
 b[0] = uL

 for i in range(1,N-1):
  A[i,i-1] = -1
  A[i,i]   =  2
  A[i,i+1] = -1
  b[i]     = h**2*f(x[i])

 A[N-1,N-1] = 1
 b[N-1]     = uR

 u = np.linalg.solve(A,b)

 plt.plot(x,u,'*-')
 plt.show()

 return u

print laplace(lambda x:-2, 0, 0, 10)
print laplace(lambda x:10*x, 0, 1, 15)
print laplace(lambda x:np.sin(2*np.pi*x), 1, 1, 20)
</code>```

Alternative implementation without Matrix Algebra (using the Jacobi method)

```<code>def laplace(f, uL, uR, N):
 h=1./(N-1)
 b=[f(i*h)*h*h for i in range(N)]
 b[0],b[-1]=uL,uR
 u = [0]*N

 def residual():
  return np.sqrt(sum(r*r for r in[b[i] + u[i-1] - 2*u[i] + u[i+1] for i in range(1,N-1)]))

 def jacobi():
  return [uL] + [0.5*(b[i] + u[i-1] + u[i+1]) for i in range(1,N-1)] + [uR]

 while residual() > 1e-6:
  u = jacobi()

 return u
</code>```

You may however use any other method to solve the Laplace equation. If you use an iterative method, you should iterate until the residual \$|b-Au| < 10^{-6}\$, with \$b\$ being the right hand side vector \$u_L,f_1 h^2,f_2 h^2, \dots\$

Notes

Depending on your solution method you may not solve the examples exactly to the given solutions. At least for \$N \to \infty\$ the error should approach zero.

Standard loopholes are disallowed, built-ins for PDEs are allowed.

Bonus

A bonus of -30% for displaying the solution, either graphical or ASCII-art.

Winning

This is codegolf, so shortest code in bytes wins!

答:
Axiom, <s>579</s> 460 bytes

```<code>l(w,y)==(r:=0;for i in 1..y|index?(i,w)repeat r:=i;r)
g(z:EQ EXPR INT,y:BasicOperator,a0:Float,a1:Float,a2:Float):Float==(r:=digits();digits(r+30);q:=seriesSolve(z,y,x=0,[a,b])::UTS(EXPR INT,x,0);w:=eval(q,0);s:=l(w,r+30);o:=solve([w.s=a0,eval(q,1).s=a1]::List(EQ POLY Float),[a,b]);v:=eval(eval(eval(q,a2).s,o.1.1),o.1.2);digits(r);v)
m(z:EXPR INT,a0:Float,a1:Float,n:INT):List Float==(n:=n-1;y:=operator 'y;r:=[g(D(y x,x,2)=-z,y,a0,a1,i/n)for i in 0..n];r)
</code>```

ungolf it and test

```<code>Len(w,y)==(r:=0;for i in 1..y|index?(i,w)repeat r:=i;r)

-- g(z,a0,a1,a2)
-- Numeric solve z as f(y''(x),y'(x),y(x))=g(x) with ini conditions y(0)=a0   y(1)=a1 in x=a2
NSolve2order(z:EQ EXPR INT,y:BasicOperator,a0:Float,a1:Float,a2:Float):Float==
      r:=digits();digits(r+30)
      q:=seriesSolve(z,y,x=0,[a,b])::UTS(EXPR INT,x,0)
      w:=eval(q,0);s:=Len(w,r+30)
      o:=solve([w.s=a0,eval(q,1).s=a1]::List(EQ POLY Float),[a,b])
      v:=eval(eval(eval(q,a2).s,o.1.1),o.1.2);digits(r)
      v

InNpoints(z:EXPR INT,a0:Float,a1:Float,n:INT):List Float==(n:=n-1;y:=operator 'y;r:=[NSolve2order(D(y x,x,2)=-z,y,a0,a1,i/n)for i in 0..n];r)
</code>```

the function for the question is m(,,,)
the above code is put in the file  "file.input"
and load in Axiom. The result depends from the digits() function.

if some one think it is not golfed => he or she can show how to do it...
thanks

PS

it seems the 6 numbers afther the . for e^(x^2) are not ok here or in the examples
but here i increase the digits but numbers not change... for me it means that
numbers in example are wrong. Why all other has not showed their numbers?

for sin(2*%pi*x) there are problems too

"Here the exact solution is u = (sin(2*π*x))/(4*π^2)+1"
i copyed the exact solution for x=1/19:

```<code>              (sin(2*π/19))/(4*π^2)+1
</code>```

in WolframAlpha
https://www.wolframalpha.com/input/?i=(sin(2%CF%80%2F19))%2F(4%CF%80%5E2)%2B1
it result

```<code>1.008224733636964333380661957738992274267070440829381577926...
1.0083001
  1234
1.00822473
</code>```

1.0083001 proposed as result
is different in the 4th digit from the real result 1.00822473...
(and not 6th)

```<code>-- in interactive mode
(?) -> )read  file
(10) -> digits(9)
   (10)  10
                                                        Type: PositiveInteger
(11) -> m(-2,0,0,10)
   (11)
   [0.0, - 0.0987654321, - 0.172839506, - 0.222222222, - 0.24691358,
    - 0.24691358, - 0.222222222, - 0.172839506, - 0.098765432, 0.0]
                                                             Type: List Float
(12) -> m(10*x,0,1,15)
   (12)
   [0.0, 0.189868805, 0.376093294, 0.555029155, 0.72303207, 0.876457726,
    1.01166181, 1.125, 1.21282799, 1.27150146, 1.29737609, 1.28680758,
    1.2361516, 1.14176385, 1.0]
                                                             Type: List Float
(13) -> m(sin(2*%pi*x),1,1,20)
   (13)
   [1.0, 1.00822473, 1.01555819, 1.02120567, 1.0245552, 1.02524378, 1.02319681,
    1.0186361, 1.01205589, 1.00416923, 0.99583077, 0.987944112, 0.981363896,
    0.976803191, 0.97475622, 0.975444804, 0.978794326, 0.98444181, 0.991775266,
    1.0]
                                                         Type: List Float
(14) -> m(exp(x^2),0,0,30)
   (14)
   [0.0, 0.0202160702, 0.0392414284, 0.0570718181, 0.0737001105, 0.0891162547,
    0.103307204, 0.116256821, 0.127945761, 0.138351328, 0.147447305,
    0.155203757, 0.161586801, 0.166558343, 0.170075777, 0.172091643,
    0.172553238, 0.171402177, 0.168573899, 0.163997099, 0.157593103,
    0.149275146, 0.13894757, 0.126504908, 0.111830857, 0.0947971117,
    0.0752620441, 0.0530692118, 0.0280456602, - 0.293873588 E -38]
                                                             Type: List Float
</code>```

ContentLicense: CC BY-SA 4.0

Title: Solve the Laplace equation

Body:
Axiom, <s>579</s> 460 bytes

l(w,y)==(r:=0;for i in 1..y|index?(i,w)repeat r:=i;r)
g(z:EQ EXPR INT,y:BasicOperator,a0:Float,a1:Float,a2:Float):Float==(r:=digits();digits(r+30);q:=seriesSolve(z,y,x=0,[a,b])::UTS(EXPR INT,x,0);w:=eval(q,0);s:=l(w,r+30);o:=solve([w.s=a0,eval(q,1).s=a1]::List(EQ POLY Float),[a,b]);v:=eval(eval(eval(q,a2).s,o.1.1),o.1.2);digits(r);v)
m(z:EXPR INT,a0:Float,a1:Float,n:INT):List Float==(n:=n-1;y:=operator 'y;r:=[g(D(y x,x,2)=-z,y,a0,a1,i/n)for i in 0..n];r)

ungolf it and test

Len(w,y)==(r:=0;for i in 1..y|index?(i,w)repeat r:=i;r)

-- g(z,a0,a1,a2)
-- Numeric solve z as f(y''(x),y'(x),y(x))=g(x) with ini conditions y(0)=a0   y(1)=a1 in x=a2
NSolve2order(z:EQ EXPR INT,y:BasicOperator,a0:Float,a1:Float,a2:Float):Float==
      r:=digits();digits(r+30)
      q:=seriesSolve(z,y,x=0,[a,b])::UTS(EXPR INT,x,0)
      w:=eval(q,0);s:=Len(w,r+30)
      o:=solve([w.s=a0,eval(q,1).s=a1]::List(EQ POLY Float),[a,b])
      v:=eval(eval(eval(q,a2).s,o.1.1),o.1.2);digits(r)
      v

InNpoints(z:EXPR INT,a0:Float,a1:Float,n:INT):List Float==(n:=n-1;y:=operator 'y;r:=[NSolve2order(D(y x,x,2)=-z,y,a0,a1,i/n)for i in 0..n];r)

the function for the question is m(,,,)
the above code is put in the file  "file.input"
and load in Axiom. The result depends from the digits() function.

if some one think it is not golfed => he or she can show how to do it...
thanks

PS

it seems the 6 numbers afther the . for e^(x^2) are not ok here or in the examples
but here i increase the digits but numbers not change... for me it means that
numbers in example are wrong. Why all other has not showed their numbers?

for sin(2*%pi*x) there are problems too

"Here the exact solution is u = (sin(2*π*x))/(4*π^2)+1"
i copyed the exact solution for x=1/19:

              (sin(2*π/19))/(4*π^2)+1

in WolframAlpha
https://www.wolframalpha.com/input/?i=(sin(2%CF%80%2F19))%2F(4%CF%80%5E2)%2B1
it result

1.008224733636964333380661957738992274267070440829381577926...
1.0083001
  1234
1.00822473

1.0083001 proposed as result
is different in the 4th digit from the real result 1.00822473...
(and not 6th)

-- in interactive mode
(?) -> )read  file
(10) -> digits(9)
   (10)  10
                                                        Type: PositiveInteger
(11) -> m(-2,0,0,10)
   (11)
   [0.0, - 0.0987654321, - 0.172839506, - 0.222222222, - 0.24691358,
    - 0.24691358, - 0.222222222, - 0.172839506, - 0.098765432, 0.0]
                                                             Type: List Float
(12) -> m(10*x,0,1,15)
   (12)
   [0.0, 0.189868805, 0.376093294, 0.555029155, 0.72303207, 0.876457726,
    1.01166181, 1.125, 1.21282799, 1.27150146, 1.29737609, 1.28680758,
    1.2361516, 1.14176385, 1.0]
                                                             Type: List Float
(13) -> m(sin(2*%pi*x),1,1,20)
   (13)
   [1.0, 1.00822473, 1.01555819, 1.02120567, 1.0245552, 1.02524378, 1.02319681,
    1.0186361, 1.01205589, 1.00416923, 0.99583077, 0.987944112, 0.981363896,
    0.976803191, 0.97475622, 0.975444804, 0.978794326, 0.98444181, 0.991775266,
    1.0]
                                                         Type: List Float
(14) -> m(exp(x^2),0,0,30)
   (14)
   [0.0, 0.0202160702, 0.0392414284, 0.0570718181, 0.0737001105, 0.0891162547,
    0.103307204, 0.116256821, 0.127945761, 0.138351328, 0.147447305,
    0.155203757, 0.161586801, 0.166558343, 0.170075777, 0.172091643,
    0.172553238, 0.171402177, 0.168573899, 0.163997099, 0.157593103,
    0.149275146, 0.13894757, 0.126504908, 0.111830857, 0.0947971117,
    0.0752620441, 0.0530692118, 0.0280456602, - 0.293873588 E -38]
                                                             Type: List Float


答:
JavaScript, 12 bytes, 10 numbers, Cracked

Let's play with arrays:

```<code>alert(_[__])
</code>```

_ is a hidden character.

I wanted robbers to think that the first hidden character was a +, but i didn't realize that would work.

Intended solution :

 alert(-[~0])

 alert(-[~1])

 alert(-[~2])

 ...

 alert(-[~9])

Title: Code ladder, Cops

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

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

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

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

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

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

Example post:

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

MyLang, 9 bytes, 8 numbers

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

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

Leaderboard

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

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Body:
JavaScript, 12 bytes, 10 numbers, Cracked

Let's play with arrays:

alert(_[__])

_ is a hidden character.

I wanted robbers to think that the first hidden character was a +, but i didn't realize that would work.

Intended solution :

 alert(-[~0])

 alert(-[~1])

 alert(-[~2])

 ...

 alert(-[~9])


Title: Code ladder, Robbers

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

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

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

Example post:

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

Original code:

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

Code that produces 1 - 8:

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

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

Body:
Octave, 17 bytes, 10 numbers, by Stewie Griffin

original:
_i_(__i__(2_5_))

solution:
fix( 'i'-(2*52))
fix( 'j'-(2*52))
fix( 'k'-(2*52))
fix( 'l'-(2*52))
fix( 'm'-(2*52))
fix( 'n'-(2*52))
fix( 'o'-(2*52))
fix( 'p'-(2*52))
fix( 'q'-(2*52))
fix( 'r'-(2*52))


答:
Perl, 14 bytes, 10 numbers, by Dada

Original code:

```<code>say_!"___"%""_
</code>```

Code that produces 1 - 10:

say"!"+1#"%""r

say"!"+2#"%""r

say"!"+3#"%""r

say"!"+4#"%""r

say"!"+5#"%""r

say"!"+6#"%""r

say"!"+7#"%""r

say"!"+8#"%""r

say"!"+9#"%""r

say"1"+9#"%""r

I have a feeling this isn't what you were going for.

Title: Code ladder, Robbers

Body:
Perl, 14 bytes, 10 numbers, by Dada

Original code:

say_!"___"%""_

Code that produces 1 - 10:

say"!"+1#"%""r

say"!"+2#"%""r

say"!"+3#"%""r

say"!"+4#"%""r

say"!"+5#"%""r

say"!"+6#"%""r

say"!"+7#"%""r

say"!"+8#"%""r

say"!"+9#"%""r

say"1"+9#"%""r

I have a feeling this isn't what you were going for.


问:
Write a continuous quine (quine-variant)

Let's define a 2-quine as a program that prints its source code two times. For example, if the program ABC printed ABCABC, it would be a 2-quine.

Let's define a 3-quine as a program that prints its source code three times. For example, if the program ABC printed ABCABCABC, it would be a 3-quine.

Let's define a n-quine as a program that prints its source code n times.

Your task is to write a 2-quine, that prints a 3-quine, that prints a 4-quine, that prints a 5-quine, etc...

For example, here is an example of a valid submission (which is fictional of course):

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

which prints

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

which prints

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

which prints

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

etc.

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

答:
Javascript ES6 (REPL), 52 bytes

```<code>var a=a||'';$=_=>a+=`$=${$};$();`.repeat(a?1:2);$();
</code>```

Initial working implementation, may be golfable.

y.onclick=_=>z.innerText=eval("var a=a||'';$=_=>a+=`$=${$};$();`.repeat(a?1:2);$();".repeat(x.value))```
<pre class="snippet-code-html lang-html prettyprint-override"><code><input id=x><button id=y>Submit!</button><pre id=z>``````

Explanation

Based on my usual quine implementation ($=_=>`$=${$};$()`;$()).

var a||'' coerces a to an empty string if it isn't defined; otherwise, a is left as is. a will store our final result.

Each function call, a will be checked to see if it is empty/falsy. The first function call will append 2 copies of the quine because a is empty; subsequent calls will only append 1 copy because a is no longer empty.

The last function call will output the final value of a after finishing.

Body:
Javascript ES6 (REPL), 52 bytes

var a=a||'';$=_=>a+=`$=${$};$();`.repeat(a?1:2);$();

Initial working implementation, may be golfable.

y.onclick=_=>z.innerText=eval("var a=a||'';$=_=>a+=`$=${$};$();`.repeat(a?1:2);$();".repeat(x.value))

<input id=x><button id=y>Submit!</button><pre id=z></pre>

Explanation

Based on my usual quine implementation ($=_=>`$=${$};$()`;$()).

var a||'' coerces a to an empty string if it isn't defined; otherwise, a is left as is. a will store our final result.

Each function call, a will be checked to see if it is empty/falsy. The first function call will append 2 copies of the quine because a is empty; subsequent calls will only append 1 copy because a is no longer empty.

The last function call will output the final value of a after finishing.


答:
Octave, 19 bytes, 10 numbers, cracked

```<code>__sca__1_)___'-_6_'
</code>```

_ is the hidden character.

Intended solution:

 pascal(10)('a'-96)'

Title: Code ladder, Cops

Body:
Octave, 19 bytes, 10 numbers, cracked

__sca__1_)___'-_6_'

_ is the hidden character.

Intended solution:

 pascal(10)('a'-96)'


答:
Python 2, 49 bytes, 10 numbers, cracked

```<code>y=10__;s='09________';print int(s[8__________:y])
</code>```

_ is the hidden character.

Cracked by boboquack

The initial code was

y=10-0;s='0987654321';print int(s[8+y:]+s[y-1:y])

Title: Code ladder, Cops

Body:
Python 2, 49 bytes, 10 numbers, cracked

y=10__;s='09________';print int(s[8__________:y])

_ is the hidden character.

Cracked by boboquack

The initial code was

y=10-0;s='0987654321';print int(s[8+y:]+s[y-1:y])


答:
Perl, 12 bytes, 10 numbers, Cracked!

Underscores represent unknown characters.

```<code>____;say__-9
</code>```

Probably fairly easy, and it wouldn't surprise me if there were multiple solutions. Still, it might be fun to crack.

(The intended solution was the same as the crack. This is fundamentally just a problem about assigning 10 to a variable in four characters, which is surprisingly difficult in Perl; unlike many golfing languages, it doesn't have a variable that helpfully starts at 10.)

Title: Code ladder, Cops

Body:
Perl, 12 bytes, 10 numbers, Cracked!

Underscores represent unknown characters.

____;say__-9

Probably fairly easy, and it wouldn't surprise me if there were multiple solutions. Still, it might be fun to crack.

(The intended solution was the same as the crack. This is fundamentally just a problem about assigning 10 to a variable in four characters, which is surprisingly difficult in Perl; unlike many golfing languages, it doesn't have a variable that helpfully starts at 10.)