首先他们来了


29

马丁·尼莫勒(MartinNiemöller)的一首诗是“他们首先来了……”

First they came for the Socialists, and I did not speak out-
Because I was not a Socialist.

Then they came for the Trade Unionists, and I did not speak out-
Because I was not a Trade Unionist.

Then they came for the Jews, and I did not speak out-
Because I was not a Jew.

Then they came for me-and there was no one left to speak for me.

您的任务是输出以上内容。这是,因此以字节为单位的最短代码胜出!

规则

  • 您可能会包含不影响外观的多余空格。允许使用一条尾随的换行符。
  • 否则,输出必须完全匹配,包括换行符的位置。
  • 根据元标准,您可以输出字符串列表。但是,您必须包括空行。

请注意,我个人认为这不是骗人的,因为这首诗的布局方式-高尔夫需要一定的创造力。关于这是否是骗子的元讨论可以在这里找到。


7
除了RickRoll挑战之外,我不确定这会给网站带来什么。
AdmBorkBork

7
我不喜欢这里的子骗子。
程序员


11
一次,我不认为这是Rickroll的骗子。这里有有意义的结构。并行性允许来自不同的策略。重新打开。
xnor

3
这种结构是赞成成为人力的骗子,而不是反对。
彼得·泰勒

Answers:


8

SOGL V0.12103个 102 101 字节

 →∑‘¾ο╤Ε9‘}ψ⁴‘¹"4¡‘Q°‘:¹¹I{ū_:¹"Eā/}l6⁸SÆ□⁴↔b⅜╬I℮;YΥηκ*█⅞F^Κ⅜⁸{x⅔⁵⅟╚?Z‘O}"Ι╚╬√⅔δηvΧχ⁷⁾Η<υL┼!Ο'μΠ⁵╝⁷‘⁾

在这里尝试!

说明(在这里我将压缩字符串替换..为节省空间):

..‘.‘..‘                              push "socialist", "trade unionist" and "jew"
        ¹                             wrap in an array: ["socialist", "trade unionist", "jew"]
         "..‘..‘                      push "first" and "then"
                :                     duplicate the then
                 ¹                    wrap in an array: ["first","then","then"]
                  ¹                   wrap those two in an array: [["socialist", "trade unionist", "jew"], ["first","then","then"]]
                   I                  rotate clockwise: [[first,socialist], [then,trade unionist], [then,jew]]
                    {         }       for each do, pushing the array
                     ū                  uppercase the 1st letter of each word in the array - ["First", "Socialist"]
                      _                 splat the contents on the stack   "First", "Socialist"
                       :                duplicate the 2nd one             "First", "Socialist", "Socialist"
                        ¹               wrap in an array                  ["First", "Socialist", "Socialist"]
                         "..‘           push "ŗ they came for the ŗs, and I did not speak out-\nBecause I was not a ŗ." with ŗ replaced with its appropriate item in the array
                             O          output that
                               "..‘   push "then they came for me-and there was no one left to speak for me."
                                   ⁾  uppercase the 1st letter of it
                                      implicitly output it in a new line

您能补充说明吗?
Nzall

@Nzall忘了写了
dzaima

@Nzall添加了一个解释
dzaima

7

6502机器代码(C64),229字节

那种无聊的,对C64仍是可行的有几分字节体面的:)

00 C0 A9 17 8D 18 D0 A2 2C 86 FE A6 FE A0 C0 BD B6 C0 20 1E AB C6 FE 10 F2 60
C6 49 52 53 54 20 00 D4 48 45 4E 20 00 54 48 45 20 00 54 48 45 59 20 43 41 4D
45 20 00 46 4F 52 20 00 53 50 45 41 4B 20 00 41 4E 44 20 C9 20 44 49 44 20 4E
4F 54 20 00 4F 55 54 2D 0D 00 C2 45 43 41 55 53 45 20 C9 20 57 41 53 20 4E 4F
54 20 41 20 00 4D 45 2D 41 4E 44 20 54 48 45 52 45 20 57 41 53 20 4E 4F 20 4F
4E 45 20 4C 45 46 54 20 54 4F 20 00 4D 45 2E 00 2E 0D 00 53 2C 20 00 D3 4F 43
49 41 4C 49 53 54 00 D4 52 41 44 45 20 D5 4E 49 4F 4E 49 53 54 00 CA 45 57 00
0D 00 8C 35 3A 6B 2A 1F B4 90 B0 56 50 3A 41 93 B0 25 35 2A 1F B4 90 A1 56 50
3A 41 93 A1 25 35 2A 1F B4 90 97 56 50 3A 41 93 97 25 35 2A 18

在线演示

用法: SYS49152

说明:

由于它主要包含数据,而不是无意义的反汇编列表,因此,这ca65是创建此机器代码的-style汇编源:

.segment "LDADDR"
                .word   $c000           ; load address
.code
                lda     #$17            ; upper/lower mode
                sta     $d018           ; store in VIC register
                ldx     #revpoemsize    ; initialize ...
                stx     $fe             ; ... counter
loop:           ldx     $fe             ; load current position
                ldy     #$c0            ; highbyte of strings always same
                lda     revpoem,x       ; load lowbyte from table
                jsr     $ab1e           ; output 0-terminated string
                dec     $fe             ; decrement position
                bpl     loop            ; >=0 ? -> repeat
                rts                     ; done

first:          .byte   "First ", 0
then:           .byte   "Then ", 0
the:            .byte   "the ", 0
came:           .byte   "they came ", 0
for:            .byte   "for ", 0
speak:          .byte   "speak ", 0
didnot:         .byte   "and I did not ", 0
out:            .byte   "out-", $d, 0
wasnot:         .byte   "Because I was not a ", 0
noone:          .byte   "me-and there was no one left to ", 0
me:             .byte   "me.", 0
period:         .byte   ".", $d, 0
comma:          .byte   "s, ", 0
socialist:      .byte   "Socialist", 0
unionist:       .byte   "Trade Unionist", 0
jew:            .byte   "Jew", 0
p:              .byte   $d, 0

revpoem:        .byte   <me, <for, <speak, <noone, <came, <then, <p
                .byte   <period, <jew, <wasnot, <out, <speak, <didnot
                .byte   <comma, <jew, <the, <for, <came, <then, <p, <period
                .byte   <unionist, <wasnot, <out, <speak, <didnot, <comma
                .byte   <unionist, <the, <for, <came, <then, <p, <period
                .byte   <socialist, <wasnot, <out, <speak, <didnot, <comma
                .byte   <socialist, <the, <for, <came, <first
revpoemsize     = * - revpoem - 1


4

Perl 6,193个字节

say join ' they came for ','First'Socialist "Trade Unionist" Jew».map({"the {$_}s, but I did not speak out-
because I was not a $_.

Then"}),'me- and there was no one left to speak for me.'

在线尝试!


4

Perl 5,185个字节

print join" they came for ",First,(map"the ${_}s, and I did not speak out-
Because I was not a $_.

Then",Socialist,"Trade Unionist",Jew),"me-and there was no one left to speak for me."

在线尝试!

感谢@ Massa提供-3个字节!


使用加入,你可以修剪另一个五把椅子左右
马萨

@Massa不知道我怎么知道!还有其他线索吗?
Dom Hastings

我现在正在使用手机,但请在下面查看我的perl6答案!
马萨

@Massa Ahhh,太好了!谢谢!-3最后:)
Dom Hastings

3

C,248字节

感谢@Zacharý节省了9个字节。

p(x,y){printf("%s they came for the %ss, and I did not speak out-\nBecause I was not a %s.\n\n",x,y,y);}f(){p("First","Socialist");p("Then","Trade Unionist");p("Then","Jew");puts("Then they came for me-and there was no one left to speak for me.");}

在线尝试!


您可以s直接进入printf语句吗?
扎卡里

@Zacharý是的,当然。
Steadybox '17

3

C#(.NET核心)248个 246 242字节

a=>{string b=@", and I did not speak out-
Because I was not a ",c=" they came for ",d="Socialist",e="Trade Unionist";return$@"First{c+d}s{b+d}.

Then{c+e}s{b+e}.

Then{c}the Jews{b}Jew.

Then{c}me-and there was no one left to speak for me.";}

实际的换行符为我节省了一些字节。

在线尝试!

多亏了Business Cat,节省了2个字节


3

Python 3,203字节

print('First',*[f'the {s}s, and I did not speak out-\nBecause I was not a {s}.\n\nThen'for s in['Socialist','Trade Unionist','Jew']],'me-and there was no one left to speak for me.',sep=' they came for ')

在线尝试!


sep =是个天才!:-)
马萨

3

Befunge-93,348字节

".em rof kaeps ot tfel eno on saw ereht dna-em rof emac yeht nehT"52*:v
v"d not speak out-"*25"Because I was not a "<   p5-2*89p1-2*89"vvJew."<
> "id I dna ">",sweJ>v"67+2p66+5p     v     ^p2-2*89"vTrade Unionist."<
>"tsriF">:#,v>",stsinoinU edarTv"67+3pv     ^   p3+66p40"^_Socialist."<
>"nehT"52*: v>",stsilaicoS@"67+3p     >" eht rof emac yeht "

在线尝试!


3

Befunge,293个 274 270字节

62574732594932584832001v_@#:\0\!<
0-*84g+3/"P"\%"P"::+p00<_|#:-1g0
84!-"*":g+3/"P"\%"P"::+1\<+1_$#:^#-2\,-**
&First0 they came for %the Qs, and I did not speak out-*Because I was not a (.**
ThenOme-and there was no one left to speak for me.*$Jew*Socialist/Trade Unionist

在线尝试!

这是与现有Befunge解决方案不同的方法。它使用一种链接列表来存储常用短语的字典,然后在堆栈上仅具有一个简单的值列表,这些值表示短语输出的顺序。


2

视网膜,176字节


 Socialists, Trade Unionists, Jews,1me-and there was no one left to2for me.
( .+?)s,
1the$& and I did not2out-¶Because I was not a$1.¶¶Then
^
First
1
 they came for 
2
 speak 

在线尝试!说明:12是重复的字符串,其长度足以值得重复数据删除。在First后来加入,使其更容易选择的重复部分的占位符,“他们来了[组] S,我是不是一个[组]我没有说话,因为出,然后”,这是由扩张第二阶段。


2

的JavaScript(ES6),231个 227 223 221字节

_=>`First${t=" they came for "}the Socialist${a=`s, and I did not speak out-
Because I was not a `}Socialist${t=`.

Then`+t}the ${(u="Trade Unionist")+a+u+t}the Jew${a}Jew${t}me-and there was no one left to speak for me.`

试试吧

o.innerText=(
_=>`First${t=" they came for "}the Socialist${a=`s, and I did not speak out-
Because I was not a `}Socialist${t=`.

Then`+t}the ${(u="Trade Unionist")+a+u+t}the Jew${a}Jew${t}me-and there was no one left to speak for me.`
)()
<pre id=o>


2

爪哇8,250个 236字节

o->{String t=" they came for ",r="First";for(String s:"Socialist,Trade Unionist,Jew".split(","))r+=t+"the "+s+"s, and I did not speak out-\nBecause I was not a "+s+".\n\nThen";return r+t+"me-and there was no one left to speak for me.";}

在这里尝试。


2

的JavaScript(ES6),210 207 206 203字节

我的另一种解决方案的另一种方法因此认为,既然挑战已经重新面临,就值得将其修改为自己的答案。

_=>`First${["Socialist","Trade Unionist","Jew"].map(x=>t+`the ${x}s, and I did not speak out-
Because I was not a ${x}.

Then`,t=` they came for `).join``+t}me-and there was no one left to speak for me.`

试试吧

o.innerText=(
_=>`First${["Socialist","Trade Unionist","Jew"].map(x=>t+`the ${x}s, and I did not speak out-
Because I was not a ${x}.

Then`,t=` they came for `).join``+t}me-and there was no one left to speak for me.`
)()
<pre id=o>


2

盖亚179 175字节

⇓“the ”3ṁ“s, and I did not speak out-¶Because I was not a ”2ṃ“.¶¶Then
“ they came for 
First”“Socialist“Trade Unionist“Jew”↓¦⇑“me-and there was no one left to speak for me.”]$

在线尝试!

说明

此处定义了3个功能(每行1个)。最底层的称为第一。被换行符代替。

⇓“the ”3ṁ“...”2ṃ“.¶¶Then  First helper function. Argument: s
⇓                         Push "Then they came for "
 “the ”                   Push "the "
       3ṁ                 Bring s to the top
         “...”            Push "s, and I did not speak out-¶Because I was not a "
              2ṃ          Push a copy of s
                “.¶¶Then  Push ".¶¶Then"


“ they came for   Helper function. No arguments.
“ they came for   Push " they came for "


First”“..“..“..”↓¦⇑“...”]$  Main function.
First”                      Push "First"
      “..“..“..”            Push the list ["Socialist" "Trade Unionist" "Jew"]
                ↓¦          Call the first helper function on each.
                  ⇑         Push "Then they came for "
                   “...”    Push "me-and there was no one left to speak for me."
                        ]$  Wrap the stack in a list and join with no separator.

2

泡泡糖149个 132 129字节

00000000: 9d4d b515 0241 14cc af8a c991 1e70 0991  .M...A.......p..
00000010: 02fe bbfd e7b7 cb1a 523d ee0e d9f8 7453  ........R=....tS
00000020: 631d 5cc2 2b84 5432 2265 760c 6315 a654  c.\.+.T2"ev.c..T
00000030: a4d6 d92a 480a 0c20 5201 a91c ec8c 2987  ...*H.. R.....).
00000040: f2ae 1634 3924 6f79 6b2e c8ee 4dba 14eb  ...49$oyk...M...
00000050: 4130 4958 3ed9 9e18 128c a94c 95fc e3e0  A0IX>......L....
00000060: b6fd fa65 c88b 1fa7 7795 e77b 25d7 488a  ...e....w..{%.H.
00000070: 9d68 f898 8792 8c82 2307 a78e bb87 647d  .h......#.....d}
00000080: 03                                       .

在线尝试!

无聊的泡泡糖答案。已经被SOGL击败了,所以很好。

-17字节的内容归功于Dom Hastings

ovs -3字节


132个字节。仍然无法击败SOGL!
Dom Hastings

@DomHastings我想你不会用Bubblegum击败SOGL ...
Egg the Outgolfer

@EriktheOutgolfer我也为这个事实感到高兴!我想花一些时间玩它,表现力超乎想象!
Dom Hastings


2

SQL 269位元组

declare @ char(18)='They came for the ',@a char(49)='s, and I did not speak out-
Because I was not a '
print'First '+@+'Socialist'+@a+'Socialist.

'+@+'Trade Unionist'+@a+'Trade Unionist.

'+@+'Jew'+@a+'Jew.

'+@+' me-and there was no one left to speak for me.'

1
嗨,欢迎来到PPCG!我已编辑您的帖子以添加一些格式。至于实际的代码,我认为"Then "最后三个句子中缺少前导词,现在最后一个句子"They came for the me-..."改为而不是"Then they came for me-..."
凯文·克鲁伊森


1

质子,219字节

t='they came for'for i:'Socialist','Trade Unionist','Jew'print(i[0]=='S'? 'First':'Then',t,'the',i+'s, and I did not speak out-
Because I was not a',i+'.
')print('Then',t,'me-and there was no one left to speak for me.')

在线尝试!


1

Python 2,246字节

第一次尝试压缩字符串并返回它。显然,与其他方法相比,它需要更多的字节。高尔夫还有什么东西吗?

import zlib,base64
print zlib.decompress(base64.b64decode('eJyd0DEOwjAMBdA9p/gHoD0EAxJdgQNYiatGtDaKU1XcvikUdSkDjLb/f4NPMVlG7vgJTwOj1bRMuKiP1EfLdgBJwBkhBohm2IPpDh1z5Y7saTQux4nsdaStWDt37Vh27JtElT/oT++73PD0K1oq+97A1QKVZeI1DxVGz215mK7uO1nPf1Zu5g=='))

在线尝试!


1

罗达(Röda),204字节

{t="Then"c=" they came for";["First","Socialist",t,"Trade Unionist",t,"Jew"]|[`$_$c the ${_}s, and I did not speak out-
Because I was not a $_2.

`];[`$t$c me-and there was no one left to speak for me.`]}

在线尝试!


1

PHP,194字节

First<?=$t=" they came for ";foreach([Socialist,"Trade Unionist",Jew]as$s)echo"the ${s}s, and I did not speak out-
Because I was not a $s.

Then$t"?>me-and there was no one left to speak for me.

在线尝试


1

C(gcc),244字节

f(c){for(c=0;c<3;printf("%s they came for the %ss, and I did not speak out-\nBecause I was not a %2$s.\n\n",c++?"Then":"First",c^2?c?"Trade Unionist":"Socialist":"Jew"));puts("Then they came for me-and there was no one left to speak for me.");}

在线尝试!


1

Python 3,208字节

print(' they came for '.join(["First"]+[f"the {i}s, and I did not speak out-\nBecause I was not a {i}.\n\nThen"for i in['Socialist','Trade Unionist','Jew']]+['me-and there was no one left to speak for me.']))

在线尝试!

-1感谢@Step Hen


1
Then "for-> Then"for并且您击败了其他Python答案:)
Stephen于2008年

@StepHen感谢您注意到额外的空间!:-)
马萨

1

Clojure,285个字节

(fn[](doseq[i(range 4):let[c["Socialist""Trade Unionist""Jew"""]f #(if(< i 3)% %2)]](println(if(= i 0)"First""Then")"they came for"(str(f(str"the "(c i)"s, ")"me-")(f"and I did not speak out-\n""and there was no one left to speak for me.")(f(str"Because I was not a "(c i)".\n")"")))))

这是一个有趣的小挑战。我几次都几乎完全重写了其中的大部分内容,因为我意识到自己做的事情太round回。仍然有可能需要修改的地方很多,但是即使结果仅压缩了54个字节,我还是很满意。

代表

请参阅预高尔夫球代码以获取解释:

(defn ftc []
  ; Loop over the lines numbers for reference
  (doseq [i (range 4)
          :let [; Added a dummy last "class" since "me-" wasn't necessary,
                ;  and only having 3 elements was causing OOB errors.
                classes ["Socialist" "Trade Unionist" "Jew" ""]

                ; A helper function that executes either its first or second argument
                ;  depending on if the current line is one of the first 3 lines.
                if-first-three-lines #(if (< i 3) % %2)]]

    ; An implicit space is inserted between each of the args to println
    (println
      ; Decide on the opener
      (if (= i 0) "First" "Then")

      "they came for"

      ; Start string concatenation because the implicit space
      ;  begins complicating things.
      (str
        ; Decide which "class" the line belongs to
        (if-first-three-lines
          (str "the " (classes i) "s, ")
          "me-")

        ; Decide on the line ending
        (if-first-three-lines
          "and I did not speak out-\n"
          "and there was no one left to speak for me.")

        ; Then pick the trailer
        (if-first-three-lines
          (str "Because I was not a " (classes i) ".\n")
          "")))))

1

Japt153个 150 149 147字节

`{=` ey ¯´ f `}´-d tre °s no e ¤ft  speak f ´.`i`Sáû\E
TÎè UÍát
Jew`·rÈ+U+`e {Y}s, d I ¹d not speak t-
Be¯«e I °s not a {Y}.

Tn`}`Fir¡

测试一下

由于Oliver节省了1个字节


1

05AB1E124个 119 字节

.•RYÁ Wö∍®Ø’áÅÚ)’Òü•'x¡™vy„€Û‚½#NĀ虓ÿ€»‹é€‡€€ ÿs,€ƒ Iƒ§€–¡´€Ä-“©¶y“ƒ« I€¥€–€… ÿ.“.ª¶¶}®19£“€á-and€Ç€¥€¸€µ…¸€„¡´€‡€á.“J

在线尝试。

说明:

.•RYÁ Wö∍®Ø’áÅÚ)’Òü•
                  # Push compressed string "socialistxtrade unionistxjew"
 'x¡             '# Split it on "x": ["socialist","trade unionist","jew"]
                 # Convert each word to Titlecase: ["Socialist","Trade Unionist","Jew"]
v                 # Loop `y` over each of these strings:
 y                #  Push string `y`
 „€Û‚½            #  Push dictionary string "first then"
      #           #  Split on spaces: ["first","then"]
       N          #  Push the index of the loop
        Ā         #  Truthify it (0 remains 0; every other number becomes 1)
         è        #  Use it to index into the list
                 #  Titlecase it
 “ÿ€»‹é€‡€€ ÿs,€ƒ Iƒ§€–¡´€Ä-“
                  #  Push dictionary string "ÿ they came for the ÿs, and I did not speak out-"
                  #  where the "ÿ" are automatically filled with the strings at the top of the stack
  ©               #  Save it in the register (without popping)
                 #  Push a newline "\n"
 y                #  Push string `y` again
 “ƒ« I€¥€–€… ÿ.“  #  Push dictionary string "because I was not a ÿ."
                  #  where the "ÿ" is automatically filled again with the string
                #  Sentence case it: "because" becomes "Because"
 ¶¶               #  Push two newline characters "\n\n"
}                 # After the loop:
®                 # Push the string from the register:
                  #  "Then they came for the Jews, and I did not speak out-"
 19£              # Only leave the first 19 characters: "Then they came for "
“€á-and€Ç€¥€¸€µ…¸€„¡´€‡€á.“
                  # Push dictionary string "me-and there was no one left to speak for me."
J                 # Then join everything on the stack together (and output implicitly)

请参阅此05AB1E我的技巧(部分如何使用字典?如何压缩不属于字典的字符串?),以了解原因:

  • .•RYÁ Wö∍®Ø’áÅÚ)’Òü•"socialistxtrade unionistxjew"
  • „€Û‚½"first then"
  • “ÿ€»‹é€‡€€ ÿs,€ƒ Iƒ§€–¡´€Ä-“"ÿ they came for the ÿs, and I did not speak out-"
  • “ƒ« I€¥€–€… ÿ.“"because I was not a ÿ."
  • “€á-and€Ç€¥€¸€µ…¸€„¡´€‡€á.“"me-and there was no one left to speak for me."

-4

文字,348字节

First they came for the Socialists, and I did not speak out-
Because I was not a Socialist.

Then they came for the Trade Unionists, and I did not speak out-
Because I was not a Trade Unionist.

Then they came for the Jews, and I did not speak out-
Because I was not a Jew.

Then they came for me-and there was no one left to speak for me.

这是其语言中最短的版本,与撰写本文时的Befunge-93答案相当。


2
与几乎所有“文本”答案一样,这很无聊和懒惰
Jo King

@Jo King值得注意的一点是,它与Befunge-93答案的长度相同。
IFcoltransG
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.