N.Puck,.Page,.Ford,.Ajax,.Act I:.Scene I:.[Enter Puck and Ford]Puck:Listen to thy heart!Ford:You is the difference between a cat and I.Scene V:.[Exeunt][Enter Page and Ajax]Ajax:You is the difference between a cat and Ford.Scene X:.Page:You is the product of Puck and I.Is you as big as zero?If so,you is the sum of the sum of the sum of a big big big big big cat and a big big big cat and a big cat and a cat.If not,you big big big big big cat.Speak thy mind!Ajax:You is the sum of you and a cat.Is you as big as Ford?If not,let us return to Scene X.Page:You is the sum of a big big big cat and a big cat.Speak thy mind![Exit Page][Enter Puck]Ajax:You is the sum of you and a cat.Is you as big as Ford?If not,let us return to Scene V.[Exeunt]
オンラインでお試しください!
編集:公式のSPL実装と互換性のある回答を作成しました-以前は機能しませんでした。
シーン番号が連続している必要がないため、6バイトをゴルフしました。
説明:
SPLは、シェークスピアの演劇のように見えるように設計されたエソランです。正の名詞の値は1(ここではcatが使用されます)、負の名詞の値は-1(使用されたものはありませんが豚はその1つです)です。形容詞は、定数に2を掛けて変更します。
N.
最初のドットまでがすべてタイトルであり、問題ではありません。
Puck,. row counter
Page,. column counter
Ford,. input
Ajax,. temp
文字は整数変数で、それぞれにスタックもありますが、その機能を使用する必要はありませんでした。
Act I:.
Scene I:.
行為とシーンはgotoラベルとして使用されます
[Enter Puck and Ford]
ちょうど2人のキャラクターが同時にステージにいる場合にのみ役立ちます。
Puck:Listen to thy heart!
数値を読み取り、フォードにそれを記憶させます。
Ford:You is the difference between a cat and I.
ご覧のとおり、SPLではEngrishが有効です。これにより、パックの価値は「猫と私とでは異なります」。しかし、それはどういう意味ですか?cat
は正の名詞なので、Puck = 1 - Ford
です。
Scene II:.
[Exeunt]
Exeuntは単なる「exit」の複数形であり、引数がないと、ステージ上の全員が退出することになります。
[Enter Page and Ajax]
Ajax:You is the difference between a cat and Ford.
それはまたPage = 1 - Ford
別の俳優によって話されているのでI
間違っています。ループなので、の値をコピーすることはできませんPuck
。
Scene III:.
Page:You is the product of Puck and I.
今ではかなり簡単です。Ajax = Puck * Page
。
Is you as big as zero?
「as [adj] as」は==
演算子です。
If so,you is the sum of the sum of the sum of a big big big big big cat and a big big big cat and a big cat and a cat.
Ajax == 0 ...の場合、「cat」は1、「big cat」は2、「big big cat」は4などです。単純な定数を代入すると、「32と8と2と1の合計の合計」->「40と2と1の合計の合計」->「42と1の合計」が得られます。 -> "43"、これは+のASCIIです。
If not,you fat fat fat fat fat cat.
それ以外の場合は、「ファットファットファットファットファットキャット」であるため、Ajaxは32の値(スペースのASCII)を取得します。
Speak thy mind!
これは、文字を出力するためのコマンドです。
Ajax:
You sum you and cat.Is you as big as Ford?If not,let us return to Scene III.
これはループ構造です。「あなたと猫を合計します」はページをインクリメントし、if(Page != Ford) goto Scene III
。プログラムの残りの部分は同じコンポーネントを使用するため、読みやすい擬似コードバージョンを以下に示します。
シーン1:
input = [入力番号];
行= 0-入力+ 1;
Scene2:
col = 0-入力+ 1;
Scene3:
temp = row * col;
if(temp == 0){
temp = '+';
} else {
temp = '';
}
putchar(temp);
ページ=ページ+ 1;
if(Page!= Ford)goto Scene3;
Ajax = 10;
putchar(Ajax);
パック=パック+ 1;
if(Puck!= Ford)goto Scene2;