注意:此答案并不意味着会成为竞争对手
To Be or Not To Be, This is the Answer.
Hamlet, the main player in our story.
Horatio, Hamlet's guide through his internal struggles.
The Ghost, a handsome honest bold fair gentle king.
Claudius, the worthless usurper of the throne.
Ophelia, who Hamlet always writes two.
Polonius, the unfortunate third man caught between Hamlet and Claudius.
Brabantio, the greater.
Banquo, the lesser.
Emilia, the greater.
Egeus, the lesser.
Othello, the greater.
Orsino, the lesser.
Tybalt, the greater.
Titania, the lesser.
Valentine, who doubled is greater.
Viola, who doubled is lesser.
Act I: A simple question in so many words.
Scene I: Hamlet passes judgment over the cast.
[Enter Hamlet and Horatio]
Hamlet:
Thou art the sum of a good healthy sunny warrior and a lovely day.
[Exit Horatio]
[Enter Claudius]
Hamlet:
Thou art the sum of The Ghost and warm cute brave trustworthy hero.
[Exit Claudius]
[Enter Ophelia]
Hamlet:
Thou art the sum of Claudius and a smooth spaceman.
[Exit Ophelia]
[Enter Polonius]
Hamlet:
Thou art the sum of Ophelia and a plum.
[Exit Polonius]
[Enter Brabantio]
Hamlet:
Thou art the sum of The Ghost and the sum of The Ghost and a rich kingdom.
[Exit Brabantio]
[Enter Banquo]
Hamlet:
Thou art the sum of Brabantio and The Ghost.
[Exit Banquo]
[Enter Emilia]
Hamlet:
Thou art the sum of Brabantio and the sum of joy and a gentle girl.
[Exit Emilia]
[Enter Egeus]
Hamlet:
Thou art the sum of Emilia and The Ghost.
[Exit Egeus]
[Enter Othello]
Hamlet:
Thou art the sum of Emilia and the sum of a cunning lover and the sweetest golden embroidered rose.
[Exit Othello]
[Enter Orsino]
Hamlet:
Thou art the sum of Othello and The Ghost.
[Exit Orsino]
[Enter Tybalt]
Hamlet:
Thou art the sum of Othello and the sum of happiness and fair fine heaven.
[Exit Tybalt]
[Enter Titania]
Hamlet:
Thou art the sum of Tybalt and The Ghost.
[Exit Titania]
[Enter Valentine]
Hamlet:
Thou art the sum of Tybalt and the sum of a happy day and a pony.
[Exit Valentine]
[Enter Viola]
Hamlet:
Thou art the sum of Valentine and The Ghost.
[Exeunt]
Scene II: The beginning of Horatio's interrogation.
[Enter Hamlet and Horatio]
Hamlet:
Horatio:
Open your mind.
Art thou as good as Tybalt? If so, let us proceed to Scene IV.
Art thou as good as Titania? If so, let us proceed to Scene IV.
Art thou as good as Ophelia? If not, let us proceed to Scene XII.
Scene III: Are we to?
Horatio:
Open your mind.
Art thou as good as The Ghost? If so, let us proceed to Scene VII.
Let us proceed to Scene XII.
Scene IV: Can we go further than t?
Horatio:
Open your mind.
Art thou as good as Claudius? If so, let us proceed to Scene III.
Art thou as good as Valentine? If so, let us proceed to Scene VI.
Art thou as good as Viola? If so, let us proceed to Scene VI.
Art thou as good as Othello? If so, let us proceed to Scene V.
Art thou as good as Orsino? If not, let us proceed to Scene XII.
Scene V: Oone oor twoo?
Horatio:
Open your mind.
Art thou as good as The Ghost? If so, let us proceed to Scene VII.
Art thou as good as Othello? If so, let us proceed to Scene III.
Art thou as good as Orsino? If so, let us proceed to Scene III.
Let us proceed to Scene XII.
Scene VI: Hamlet desperately searches for whOo?.
Horatio:
Open your mind.
Art thou as good as Othello? If so, let us proceed to Scene III.
Art thou as good as Orsino? If so, let us proceed to Scene III.
Let us proceed to Scene XII.
Scene VII: Knowing to, what to do?
Horatio:
Open your mind.
Art thou as good as Brabantio? If so, let us proceed to Scene VIII.
Art thou as good as Banquo? If not, let us proceed to Scene XII.
Scene VIII: Learning what to Bleive.
Horatio:
Open your mind.
Art thou as good as me? If so, let us proceed to Scene XI.
Art thou as good as Emilia? If so, let us proceed to Scene X.
Art thou as good as Egeus? If so, let us proceed to Scene X.
Art thou as good as Polonius? If not, let us proceed to Scene XII.
Scene IX: The Eend is nigh?
Horatio:
Open your mind.
Art thou as good as me? If so, let us proceed to Scene XI.
Let us proceed to Scene XII.
Scene X: Wee may havee succeeeedeed.
Horatio:
Open your mind.
Art thou as good as Emilia? If so, let us proceed to Scene IX.
Art thou as good as Egeus? If so, let us proceed to Scene IX.
Art thou as good as me? If not, let us proceed to Scene XII.
Scene XI: Hamlet is at peace.
Horatio:
Thou art a beacon of happiness.
Let us proceed to Scene XIII
Scene XII: The demons have won.
Horatio:
Thou art nothing.
Scene XIII: Hamlet opens up.
Horatio:
Hamlet! Open your heart.
[Exeunt]
如果为false,则输出0;如果为true,则输出1。
这可以很容易地缩短(如果人们真的希望我这样做,可以缩短单词的长度),但是这样做对好心人是一记耳光。我一直感觉到Horatio是Hamlet的无名英雄,因此我确保他是向Hamlet传达强烈的独白的人,Hamlet必须最终证明他和Horatio一样好(他代表换行)。
代码本身非常简单。没有Hamlet的所有字符都是ascii值(顺序:)newline,space,0,2,3,B,b,E,e,O,o,T,t,V,v
,然后代码是一个简单的状态机(特别是DFA),它转换Scene XI
为接受状态和Scene XII
拒绝状态。
。
完成此操作后,我将其插入莎士比亚,使用了这样的事实:当它们在数字上相邻时,我可以下降到下一个状态。我只用标题中链接的莎士比亚版本进行了测试,但是我相信我们通过实现iirc定义了一种语言。