複数プログラムQuinecatenate!


22

あなたの仕事は、3つの異なる言語A、B、Cを提供し、次のような2つの異なるプログラムPとQを作成することです。

Pは言語Aのクインですが、BまたはCのクインではありません。

Qは言語Bのクインですが、AとCのクインではありません。そして

Pの後に連結されたQ(間に新しい文字が追加されていない)は、言語Cではキインですが、BやAではキインではありません。

これはcodegolfで、スコアは最終的な連結されたクインの長さです。繰り返しますが、適切なクインのルールを守って ください-ソースコードを読んだり、空のプログラムをしたりしない


2
コメントのルール?
アディソンクランプ

それは私が前に考えていなかったものです。あなたはそれを印刷することを心配する必要があり、言語Cが同じコメント構文または何かを持っていることを確認する必要があるが、私は柔軟だから、私は彼らをスライドさせたいと思う。
ファラズマスロ

「馬ではない」とは「何かをする」または「少なくとも走る」という意味ですか?
LegionMammal978

1
コンパイラーに入れると、ソースコードは出力されません。ソースコードを出力しない限り、エラーを実行またはスローしたり、他の何かをコンパイルしたり出力したりできません。
ファラズマスロール

興味のある人なら誰でも、
ETHproductions

回答:


11

Fission + CJam + GolfScript、38 36バイト

核分裂、6バイト

'!+OR"

これはMartinBüttnerのFission quinesの 1つです。オンラインでお試しください!

CJam、30バイト

' {"''"@*" "+YX#<
\"0$~"N}0$~

最後のバイトは改行です。オンラインでお試しください!

GolfScript、36バイト

'!+OR"' {"''"@*" "+YX#<
\"0$~"N}0$~

最後のバイトは改行です。オンラインでお試しください!

検証

$ wc -c P Q
 6 P
30 Q
36 total
$ cat P Q > P+Q
$ 
$ Fission P 2>&- | diff -qs - P
Files - and P are identical
$ cjam P 2>&- | diff -qs - P
Files - and P differ
$ golfscript P 2>&- | diff -qs - P
Files - and P differ
$ 
$ cjam Q 2>&- | diff -qs - Q
Files - and Q are identical
$ golfscript Q 2>&- | diff -qs - Q
Files - and Q differ
$ Fission Q 2>&- | diff -qs - Q
Files - and Q differ
$ 
$ golfscript P+Q 2>&- | diff -qs - P+Q
Files - and P+Q are identical
$ Fission P+Q 2>&- | diff -qs - P+Q
Files - and P+Q differ
$ cjam P+Q 2>&- | diff -qs - P+Q
Files - and P+Q differ

使い方

核分裂

  • R 右に移動する原子をスポーンし、端で回ります。

  • "印刷モードを切り替えます。次までのすべて"が印刷されます。

  • '! アトムを「!」のコードポイントに設定します。

  • +は、原子の質量を増分し、それをのコードポイントに設定し"ます。

  • O コードポイントがアトムの質量である文字を出力し、アトムを破壊します。

CJam

'       e# Push a space character.
{       e# Push the following code block:
  "''"  e# Push that string.
  @*    e# Separate its characters by spaces.
  " "+  e# Append one more space.
  YX#   e# Raise 2 to the first power. Pushes 2.
  <     e# Discard all but the first two characters of the string, i.e., "' ".
  \     e# Swap the string "' " with the code block in execution.
  "0$~" e# Push that string.
  N     e# Push a linefeed.
}       e#
0$~     e# Push a copy of the code block and execute it.

GolfScript

'!+OR"' # Push that string.
{       # Push the following code block:
  "''"  # Push that string.
  @*    # Join its characters, separating them by the first string.
  " "+  # Append a space.
  YX    # Undefined token. Does nothing.
  #<    # Comment.
  \     # Swap the string with the code block in execution.
  "0$~" # Push that string.
  N     # Undefined token. Does nothing.
}       #
0$~     # Push a copy of the code block and execute it.

別のデニスを見つけました!
ファラズマスロ

8

自己修正Brainfuck + GolfScript + CJam、29 27バイト

自己修正Brainfuck、12バイト

 {<[<]>[.>]}

先頭のスペースに注意してください。オンラインでお試しください!

GolfScript、15バイト

{So"0$~"N]}0$~

最後のバイトは改行です。オンラインでお試しください!

CJam、27バイト

 {<[<]>[.>]}{So"0$~"N]}0$~

先頭のスペースに注意してください。最後のバイトは改行です。オンラインでお試しください!

検証

$ wc -c P Q
12 P
15 Q
27 total
$ cat P Q > P+Q
$ 
$ timeout 10 smbf P | diff -sq - P
Files - and P are identical
$ golfscript P | diff -sq - P
Files - and P differ
$ cjam P | diff -sq - P
Files - and P differ
$ 
$ golfscript Q | diff -sq - Q
Files - and Q are identical
$ cjam Q | diff -sq - Q
Files - and Q differ
$ timeout 10 smbf Q | diff -sq - Q
Terminated
$ 
$ cjam P+Q | diff -sq - P+Q
Files - and P+Q are identical
$ golfscript P+Q | diff -sq - P+Q
Files - and P+Q differ
$ timeout 10 smbf P+Q | diff -sq - P+Q
Terminated

使い方

自己修正ブレインファック

SMBFは、データポインターの左側にあるソースコードから始まります。

<space>        (ignored)
{              (ignored)
<              Move the data pointer left.
[<]            Move the data pointer left to the next null byte.
>              Move the data pointer right.
[.>]           Print and move the data pointer right until null byte.
}              (ignored)

GolfScript

{            # Push the following code block:
  So         # Undefined token. Does nothing.
  "0$~"      # Push that string.
  N          # Undefined token. Does nothing.
  ]          # Wrap the stack in a array. Does not affect output.
}            #
0$~          # Push a copy of the code block and execute it.


### CJam

{<[<]>[.>]} e# Push that code block.
{           e# Push the following code block:
  So        e# Print a space. Since it is printed explicitly,
            e# it will appear at the beginning of the output.
  "0$~"     e# Push that string.
  N         e# Push a linefeed.
  ]         e# Wrap the stack in a array. Does not affect output.
            e# This makes the program an infinite, empty  loop
            e# in SMBF; it would be a quine otherwise.
}           e#
0$~         e# Push a copy of the code block and execute it.

5

Tcl、CJam、GolfScript、60 + 26 = 86 112バイト

よくゴルフされません。

Tcl、60バイト

{puts} [{join} {{} \{ \}\]} {{puts} [{join} {{} \{ \}\]} }]

このページの馬に基づいて。末尾に改行があります。

CJam、26バイト

{"' '@`+n@0"L~;"0$~"N}0$~

末尾に改行があります。

GolfScript、86バイト

{puts} [{join} {{} \{ \}\]} {{puts} [{join} {{} \{ \}\]} }]
{"' '@`+n@0"L~;"0$~"N}0$~

これはどのように作動しますか?私はtclを聞いたことがありません
ファラズMasroor

@FarazMasroor Tclの文字列は中括弧で囲むことができ、コマンド名も文字列です。そして、中括弧内のものはGolfScriptではブロックと見なされ、そのまま印刷することができます。CJamはGolfScriptに似ていますが、一方の言語でクインをもう一方の言語で動作させられないほど十分に異なります。これらの言語の選択により、これらは正しい形式で出力するためのいくつかの追加コードを備えた単なる普通のクインであり、まだゴルフされていません。
jimmy23013

3

ShapeScript + CJam + GolfScript、96 95 62バイト

ShapeScript、16バイト

'"%r"@%"0?!"'0?!

これは標準のShapeScriptクインです。オンラインでお試しください!

CJam、46バイト

];{"'\"%r\"@%\"0?!\"'0?!];"SS#~(>
\"0$~"N}0$~

最後のバイトは改行です。オンラインでお試しください!

GolfScript、62バイト

'"%r"@%"0?!"'0?!];{"'\"%r\"@%\"0?!\"'0?!];"SS#~(>
\"0$~"N}0$~

最後のバイトは改行です。Web GolfScriptでオンラインで試してください。

検証

$ wc -c P Q
16 P
46 Q
62 total
$ cat P Q > P+Q
$ 
$ shapescript P 2>&- | diff -qs - P
Files - and P are identical
$ cjam P 2>&- | diff -qs - P
Files - and P differ
$ golfscript P 2>&- | diff -qs - P
Files - and P differ
$ 
$ cjam Q 2>&- | diff -qs - Q
Files - and Q are identical
$ golfscript Q 2>&- | diff -qs - Q
Files - and Q differ
$ shapescript Q 2>&- | diff -qs - Q
Files - and Q differ
$ 
$ golfscript P+Q 2>&- | diff -qs - P+Q
Files - and P+Q are identical
$ shapescript P+Q 2>&- | diff -qs - P+Q
Files - and P+Q differ
$ cjam P+Q 2>&- | diff -qs - P+Q
Files - and P+Q differ

使い方

ShapeScript

'       Push a string that, when evaluated, does the following.
  "%r"  Push this formatting string. %r gets replaced by a string
        representation of the corresponding argument.
  @     Swap the string that is being evaluated on top of the stack.
  %     Apply formatting to the string on top of the stack.
  "0?!" Push that string.
'
0?!     Push a copy of the previous string and evaluate it.

CJam

];      e# Clear the stack. Stack is already clear. Does nothing.
{       e# Push the following code block:

  "'\"%r\"@%\"0?!\"'0?!];"

  SS#   e# Find the index of " " in " ". Pushes 0.
  ~(    e# Apply logical NOT and decrement. Pushes -2.
  >     e# Discard all but the two rightmost characters from the string,
        e# i.e., reduce it to "];".
  \     e# Swap the string "];" with the code block in execution.
  "0$~" e# Push that string.
  N     e# Push a linefeed.
}       e#
0$~     e# Push a copy of the code block and execute it.

GolfScript

'"%r"@%"0?!"'

0?!     # Find the index of the number 0 in the string and apply logical NOT.
];      # Clear the stack.
{       # Push the following code block:

  "'\"%r\"@%\"0?!\"'0?!];"

  SS    # Undefined token. Does nothing.
  #~(>  # Comment.
  \     # Swap the string with the code block in execution.
  "0$~" # Push that string.
  N     # Undefined token. Does nothing.
}       #
0$~     # Push a copy of the code block and execute it.

2
私は野生のデニスを見つけました!
ファラズマスロア
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.