クリエイティブプログラミング[終了]


12

プログラミングからストーリーを作りましょう。JavaScriptの例:

self.book = {
    "story": function() {
        var once = "upon",
            aTime = setTimeout(function() {
                // Code would continue...
            }, 1000)
    }
};

self.book.story();

規定:

  • コンパイル前、コンパイル中、コンパイル後にエラーなしで実行する必要があります。
  • ストーリーには、文字列/名前ごとに最大2つの単語しか使用できません。
    • JavaScriptの例:
      var story = "Once upon a"; // Wrong (Using more than two words)
      var story = "Onceupona"; // Wrong (Using more than two "words")
      var onceUponA = "time"; // Wrong (more than two words as a variable name)
      var onceUpon = "a time"; // This is fine
      var story = "Once upon"; // This is fine
  • ストーリーは(少なくとも)完全な文でなければなりません。
  • 何らかの出力(ストーリー自体の「印刷」など)は必要ありませんが、それはプラスです。
  • それにいくつかの創造性をもたらします。

長さのルールはないので、最も投票数が多く、最高の創造性を持つ答えが勝ちます。:)


2
この種のIOCCCエントリを思い出させます。これは、手紙のやり取りとして書かれています
-Hasturkun

文字列リテラルで2単語までしか意味しないと思いますか?それ以外の場合、文字列の結合は違法です。
jpjacobs

@jpjacobsうん。のようなものが足りない"Hi how" + "are you" + "doing today"だろうが。;)
Shaz

客観的な勝利基準はありません。
dmckee ---元モデレーター子猫

回答:


17

JavaScript

これがどれほど歴史的に正確かはわかりませんが、ECMAScriptの小さな歴史です。改善点をお気軽にご提案ください。

function story() {
    var IE = {
        from: "Microsoft"
    },
        Netscape = {
            from: "Mozilla"
        };
    var setUp = {
        oncethere: "were two",
        browsers: IE + Netscape
    };
    var parts = {

        And: function() {
            var theyfought = "to be",
                theBest = "browser";
        },
        oneday: function() {
            var they = {
                added: function() {
                    var add = "scripting languages";
                    Netscape.language = add;
                    IE.language = add;
                    return add;
                },
                thought: function() {
                    if (what(they.added) === good) {
                        they.wouldBeat = "the other";
                    }
                }
            };

        },
        andso: function() {
            function callLanguage(name) { return name };
            Netscape.language = callLanguage("Javascript");
            IE.language = callLanguage("JScript");
        },
        butThen: function() {
            var ECMA = "Standards Committee";
            (function standardized(languages) {
                (function into() {
                    return "ECMAScript";
                })();
            })([IE.language, Netscape.language]);

        },
        theEnd: function() {
            return {
                andWe: "all lived",
                happilyEver: "after..."
            };
        },
        what: function(thing) {
            return thing;
        },
        good: true || false
    };
}
story();

1
JavaScriptブックがあります。;)
Shaz

3
@Shaz HAうん。そのように書かれたJSを説明する本を想像してください。O_o
トーマスシールズ

1
ええ、確かに面白いでしょう。:P英語が私の母国語であることがうれしいです。
ウィリアム

14

JavaScript

'How';do{'computers'^Function}while(0);'they have'|'no power?'

出力は次のとおりです。0コンソール上:D


私はこれが好き。:)
シャズ

2
this.is,2,'show my',/appreciation/
ウィリアム

どのコンソールですか?おそらく、使用した言語を示す必要があります。
フィロ

JavaScriptはfirebug/に貼り付けるだけconsoleです。
ウィリアム

ここでは何もしません。それとも私だけですか?
jpjacobs

13

それはあまり物語ではなく、プログラムが行うことはコードが言うこととは何の関係もありませんが...

C ++

/* Preface (assuming nobody reads it anyway): */
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <functional>
#include <time.h>
using namespace std;
int



/*Beginning   the*/ main(){//story:

#define   a   string
ofstream ing___water;   a   river;

#define   the
long   rivers,
each,  is
(a ( river +"of").length() > 4 );
a   normal ( river +"has   the");
a bility;   for ( float ing;  short (~1 - - 2 );){
char coal,  loaded,  ships,  on,  its,  water;
coal = is;  a   lot,   lighter;
if ( lighter  .compare ( normal ))water = 'H'*2+'O'; }

a   heavier,  ship,  may;  do { a   worse,  job;  a nd,  run;
a ground; }while ( "you"&&false)//ly
;try { a nd ( "navigate   through");
a ny, such ( normal.size()==rivers     ? 

the  "ship" : may + "then"); }
catch ( exception ally ) { a wful;}} struct ural___damage {
long   before ( the   time_t o)                                                                                               const{
return "to" == a( "harbour");
for ( a   rescue ("from   leaking"),
its ("load   or");o<the'r';) {
ofstream ing,  substances;
if ("not"=="even"||substances/*that*/.put( 'a').bad())
double   damage,  to,  both   the ((short) "river"[1]);
a nd   the ("overall   environment[2].");}}

a   sentient,  ship_owner,  should,  h;int //to
the operator<( struct ural___damage   might)                                                                                  const{
a lso( "occur"), to( "his   own"),health( "when   not");
using   the ::map;
to  .find(  a ( "river   that's"),long( ~3 ) );
(to+="avoid")+=the "trouble   and";
(to+="cause")+=(less</*r*/ural___damage>()
(*this,/*seems like*/*this)?"is": a( "good   idea"));


return before ( the   time(0))||"is"==to +"late";}};

プレーンテキストとして:

メインストーリーの始まり:
川に流れる一連の水を定義します。
長い川を定義します。それぞれが4を超える長さの川です。
通常の河川は、水に短い(〜1〜2)炭を積んだ船を浮遊させる能力を持っています。石炭は、通常の水= H2Oと比較して軽くなると、かなり軽くなります。
重い船が悪化仕事をし、あなたが誤ってそのようなnormalsize川を通じて試してみて、ナビゲートしながら、座礁して、船はその後に長い時間前にexeptionallyひどい構造損傷を捕まえることのconstその負荷を漏れる救助のための港に戻りますか短い河川[1]と環境全体[2]の両方に悪い二重のダメージを与える物質でさえ、他のストリーミング物質。
衆生ship_ownerがありますオペレータ構造的損傷へのヒントなければならないのconstロングの川(〜3)トラブルを避けるために、より少ない農村部の損傷を引き起こすことを見つけるためにマップを使用していないときも、彼自身の健康に起こります。これは良いアイデアのようです。時間が遅くなる前に戻ります。

12

ことを思い出すLOLCode、すべてが物語(あるいは少なくとも、「会話」)の一種です。

ハイ
STDIOを使用できますか?
私はVARを持っています
IM IN YRループ
    UPZ VAR !! 1
    可視VAR
    IZ VAR BIGR THAN 10?GTFO。KTHX
KTHX
KTHXBYE

LOLCodeについて聞いたことがない面白い。しかし、独自の何かを思いつくことができますか、これが唯一の利用可能な構文ですか?オブジェクト指向
Shaz

2
それはシェークスピアのプログラミング言語を思い出させます。笑。
JiminP


面白くもなく、革新的でもないことを評価しました。答えではなく、コメントであるべきでした。
cemper93

1
「深刻な問題やモデレーターの注意を促すためにこの投稿にフラグを立ててください」-そのようなことは私を怖がらせます;)そして、それは主観的であるにもかかわらず、私は質問が好きです。おもしろいし、客観的な勝利基準を常に持っている必要はないと思う。Code Golfsを見てください。Golfscriptが勝者になることを事前に誰もが知っていますが、他のエントリもあります。誰もが客観性だけでプレイするなら、このサイトはすぐに死んでしまいます。
cemper93

11

ブレインファック

+++++ +   + +++++ +++++ +++++   +++++ +++++ 
  +   +   + +     +   + +         +   +     
  +   +++++ +++   +++++ +++       +   +++++ 
  +   +   + +     + ++  +         +       . 
  +   +   + +++++ +   + +++++   +++++ +++++ 

+++++ +   + +     +   +   +++++ +   + +.+++ 
[   + ]+  + +      + +    +   + ++  + +     
+   + + [ + ]       +     +   + + + + +++   
+   + +  ++ +       +     +   + +  ++ +     
+++++ +   + +++++   +     ++++. +   + +++++ 

++++  +++++ +++++ +++++  +   +              
+   + +   + +   +   +    ++  +              
++++  +++++ +++++   +    + + +              
+   + + +   +   +   +    +  ++     +        
++++  +   + +   + +.[+]  +   +    +         

+++++ +   + +++++ +   + +++++ +++++ +++++ . 
+     +   + +     +  +  +     +   + +     + 
+++   +   + +     +++   +++   +++++ +++++ + 
+     +   + +     +  +  +     + ++      +   
.     +++++ +++++ +   + +++++ +   + +++++ . 

私はこれを「誤って」実行bfしました

It's Me

* SCNR * :)


面白い!:P
シャズ


8

パイソン愛

def initely(あった、あった):
    そうでない場合:なし:
        atLeast =「多く」ではない
    who.made( "my heart")
    「ビート」、you.do(_、_)
    your.smileを返す
warm = "ly"

試してください:
    toKeep = "it" + warm
    ホーム:パス
    ing(emptyWindows)
を除く:ionally = "sad"
最後に:it = "終わった"

your = not any([1、 "to me"])または "just my toy"および\
type( ""、()、{"youWere": "more"})()

your.smile =「私を守って」
_ =「これらの日」は暖かい

しかし、あなたは「失敗しました」、あなたの#love:me

if _:only(I)
hadKnown、you.were = "innocent as a"、ラムダ\
若い、blueEyed:\
[( "but"、 "報復")myMisdoings #comesの場合
「時間」で

時々、you.do =( "make me"、#think of who
you.were) 
「」の「別の物語」

私、誰=「私はした」、あなたの#
「私の部屋」に「座る」
「見る」「見る」「古い写真」
#執lentに思い出す
the、love = you.do、「私にくれ」
who.made =すべてのこれらの間違い

「考えていた」+ it +「行きます」
on = "inf" + initely(
「ああ!、the」、「fool I've」)#been
regretting = all( "my errors")#今日

_、im = "paraly"、 "sys"の "hold"
_ =オープン; 「缶」と「缶」
_ = _(__ import __(#edビール
im)。#in ad
argv [0] #id
).read()#悲しい詩

愛、is_ = the、 "thing I"#永遠に恋しい
iTake = "私のカメラ"
go =「外に出て」
新しい、写真=「見る」、_ #at

print( "them" if 0#彼らは退屈だ
そうしないと _); 「they make」+「me think about」、love(「lost」、「for me」)

編集:これは今(カンニングされた場合)馬です。



2

私はこれを自分自身に主張することはできませんが、皆さんがそれを見ることは本当に良いことだと思います。

これはPHP Sad Poemと呼ばれ、ここから来ています

$timeWaiting = 0;
while (!$you->near($me)) {
    $me->thinkAbout($you);
    switch (true) {
        case $timeWaiting < 5:
            $me->wait($you);
            break;
        case $timeWaiting < 10:
            $me->worry();
            break;
        case $timeWaiting < 20:
            $me->lookFor($you);
            break;
        case $timeWaiting < 40:
            $me->worry();
            $me->lookFor($you);
            break;
        case $timeWaiting < 80:
            $me->worry();
            $me->cry();
            $me->lookFor($you);
            $me->lookFor($you);
            $me->lookFor($you);
            break;
        case $timeWaiting < 160:
            $me->worry();
            $me->cry();
            $me->drink();
            $me->lookFor($you);
            $me->lookFor($you);
            $me->lookFor($you);
            $me->thinkAbout($you);
            $me->thinkAbout($you);
            $me->cry();
            $me->lookFor($you);
            $me->lookFor($you);
            $me->drink();
            $me->drink();
            break;
        default:
            throw new CantLiveWithoutYou();
            die(“alone”);
        }
    $timeWaiting++;
}
$me->happy = true;

弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.