创意编程[关闭]


12

用您的编程编写故事。JavaScript中的示例:

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

self.book.story();

规定:

  • 在编译之前,之中和之后必须运行无错误。
  • 每个字符串/名称最多只能使用两个单词作为故事。
    • 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 2011年

我希望您的意思是字符串文字中最多2个单词?否则,组合字符串将是非法的。
jpjacobs 2011年

@jpjacobs是的。虽然类似的东西"Hi how" + "are you" + "doing today"会很la脚。;)
Shaz

没有客观的获胜标准。
dmckee ---前主持人小猫,

Answers:


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
Thomas Shields

1
是的,肯定会很有趣。:P我很高兴英语是我的母语。
威廉

14

的JavaScript

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

输出为:0在控制台:D上


我喜欢这个。:)
Shaz

2
this.is,2,'show my',/appreciation/
威廉

什么控制台?也许您应该指出使用的语言。
PhiLho 2011年

它是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可怕的结构性损坏常量返回港口的救援泄露它的负载或其他物质,即使不是对短河[1]和整个环境[2]都造成严重双重损害的物质。
一个有情ship_owner应提示操作员结构性破坏可能常量不使用地图上找到的一条河流,是长(约3)避免麻烦,并导致农村少受到伤害时也出现了自己的健康。这似乎是个好主意。归还的时间已经晚了。

12

让我想起了LOLCode,一切都是一个故事(或者至少是一个“对话”):

海
可以有STDIO吗?
我有一个VAR
IM IN YR LOOP
    UPZ VAR !! 1
    可见变量
    IZ VAR BIGR超过10吗?GTFO。曼谷
曼谷
KTHXBYE

有趣的是从未听说过LOLCode。但是,您能否提出一些原创的东西,或者这是唯一可用的语法?oO
Shaz

2
这让我想起了莎士比亚编程语言。大声笑。
JiminP


因既无趣又无创新而受到谴责。应该是评论,而不是答案。
cemper93 2011年

1
“将帖子标记为严重问题或主持人注意”-吓死我了;)而且我喜欢这个问题,即使它是主观的。这很有趣,我认为您不必总是有一个客观的获胜标准。看看Code Golfs:每个人都事先知道Golfscript将成为赢家,但还有其他参赛作品。如果每个人都只能凭客观地发挥作用,这个站点很快就会死掉。
cemper93 2011年

11

脑干

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

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

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

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

我“不小心”跑了过去bf,结果出来了

It's Me

* SCNR * :)


有趣!:P
Shaz

10

基本知识

有点简单化,但是对于那些熬到凌晨3点调试的人来说确实如此……

On Error GoTo sleep

比PHP更好or die
tsh

8

Python之爱

明确地定义(有):
    如果没有,则:
        atLeast =不是“很多”
    who.made(“我的心”)
    “击败”,you.do(_,_)
    返回你的微笑
温暖=“ ly”

尝试:
    toKeep =“ it” +温暖
    走路时回家:通过
    ing(emptyWindows)
除了:ionally =“ sad”
终于:它=“结束了”

您的=否([1,“ to me”])或“ just my toy”和\
type(“”,(),{“ youWere”:“更多”})()

your.smile =“保留我”
_ =在“这些日子里”温暖

但是,您=“失败了”,您的#love:我

如果_:仅(I)
hadKnown,you.were =“无辜的”,lambda \
年轻,蓝眼睛:
[(“ but”,“ retribution”)for myMisdoings #comes
及时”]

有时,you.do =(“让我成名,#想想谁
你之前是) 
“”在“另一个故事”中

我,谁=“我去过”,您的#
“坐在”“我的房间”
“看”#张旧照片
#不懈地记住
爱= you.do,“给我”
who.made =所有这些错误

“想过” +它+“会去”
on =“ inf” + initely(
“哦!”,“我傻瓜”)#been
后悔=全部(“我的错误”)今天

_,im =“ paraly”,“ sys”中的“ hold”
_ =打开;“罐头”和“罐头的”
_ = _(__ import __(#ed啤酒
im)。#in广告
argv [0] #id
).read()#悲伤的诗歌

爱情is_ =“我的事”#永远的思念
iTake =“我的相机”
去=“出去有”
新的,照片=“要看”,_ #at

打印(“ 0”表示它们“变钝”
否则_); “他们使” +“我想到”,爱(“迷失”,“为我”)

编辑:这是现在(如果被骗)的奎因。


2

bash或Unix或Linux上的其他shell:

who am I & whereis edit || eliza && find ada 

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;

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.