Re: [問題] 1-9位數不重複印出來(Shakespeare)
大家久等了,以下是ptt知名討論串用Shakespeare Programming 實作。
邏輯跟我上一篇Smalltalk 實作一樣,是對數字的商和餘數進行判斷。
https://goo.gl/RYM2bD
Shakespeare 原作者的c無法正確執行,因此我在github找到了另一個compiler
https://github.com/drsam94/Spl
可惜這個compiler說無法支援stack (實際上支援,我也不知道為什麼他說不行)
為了保險起見,我並沒有使用stack,是直接建立10個變數來判斷。
有興趣看詳解我在貼,廢話不多說了:
The following play performs on Ubuntu 14, and you shall use the compiler from
"https://github.com/drsam94/Spl" This play will determine if a number is
unique based on the absence of any repetitive digit. Some instances of
serious violation to the definition of an unique number would be: 121, 988,
677.
Romeo, the son of Montague who secretly loves and marries Juliet.
Juliet, the daughter of Capulet who secretly loves and marries Romeo.
Lady Capulet, wife of Capulet, Juliet's mother.
Montague, the patriarch of the house of Montague, Romeo's father.
Tybalt, a cousin of Juliet and rival of Romeo.
Benvolio, a cousin of Romeo and best friend.
The Ghost, who loves to insult.
King Henry, a king.
King John, a king.
King Lear, a king.
King Richard, a king.
Lady Macbeth, a lady.
Lady Macduff, a lady.
The Duke of Milan, a duke.
The Duke of Venice, a duke.
Act I: Love at the first slight.
Scene I: A lovely introduction of Romeo and Juliet.
[Enter Romeo and Juliet]
Romeo:
You pretty sweet young woman! Thou art as lovely as the difference between
the square of thyself and your smooth hair. Speak your mind.
Juliet:
Listen to your heart! You art the sum of yourself and hero.
[Exit Romeo]
Scene II: Lady Capulet charms Montague.
[Enter Montague]
Juliet:
You cursed dirty evil lying distasteful damned father! You art as
miserable as the sum of thyself and a infected smelly fat stupid animal!
[Exit Juliet]
[Enter Lady Capulet]
Lady Capulet:
Speak your mind.
Montague:
You art as foul as the sum of skilless unpracticed rural limiting
bottomless villainous mother and cow. You art as weak as the sum of tiny
normal horrid cowardly bad father and thyself. Speak your mind.
Lady Capulet:
Thou art as noble as me. You art the sum of good handsome mighty peaceful
man and thyself. You art the sum of thyself and father. Speak your mind.
Montague:
You art as good as me. You art the sum of joy and thyself. Speak your mind.
Lady Capulet:
Thou art as trustworthy as me. You art the difference between thyself and
cowardly rotten misused stinking man. You art the sum of thyself and brave
lord. Speak your mind.
Montague:
Thou art charming fair gentle warm fine lady. Speak your mind.
Lady Capulet:
Thou art as noble as a king. Open your heart!
Montague:
Speak your mind! You art as lovely as the sum of a sweet heaven and a
peaceful happy warm angel.
[Exeunt]
Act II: Capulet's support to Romeo.
Scene I: Mother always loves her beautiful daughter.
[Enter Juliet and Lady Capulet]
Lady Capulet:
You art always my girl.
[Exeunt]
Scene II: Romeo's self assert.
[Enter Lady Capulet and Romeo]
Lady Capulet:
You art the difference between yourself and the father.
Romeo:
Am I better than nothing?
Lady Capulet:
If not, we shall proceed to Let Juliet give Romeo confidence.
[Exit Romeo]
[Enter Juliet]
Lady Capulet:
You art the product of thyself and me. We shall return to Romeo's self
assert.
[Exeunt]
Scene III: Let Juliet give Romeo confidence.
[Exeunt]
[Enter Juliet and Romeo]
Romeo:
Open your heart!
Juliet:
You art the sum a brave handsome honest hero and good man. Speak your mind.
[Exeunt]
Act III: Short-tempered Cousin.
Scene I: Introduce Tybalt, Juliet's cousin.
[Enter Tybalt and Juliet]
Juliet:
You art my cousin. Open your heart.
[Exit Tybalt]
[Enter Romeo]
Juliet:
Speak your mind.
[Exit Romeo]
Scene II: Tybalt's self assert.
[Exeunt]
[Enter Juliet and Tybalt]
Juliet:
You art the sum of yourself and a cousin.
Tybalt:
Am I as miserable as you? If so, we must proceed to Act IV.
Scene III: The insults of the nobles.
[Exeunt]
[Enter The Ghost]
[Enter King Henry]
The Ghost:
You art nothing!
[Exit King Henry]
[Enter King John]
The Ghost:
You art nothing!
[Exit King John]
[Enter King Lear]
The Ghost:
You art nothing!
[Exit King Lear]
[Enter King Richard]
The Ghost:
You art nothing!
[Exit King Richard]
[Enter Lady Capulet]
The Ghost:
You art nothing!
[Exit Lady Capulet]
[Enter Lady Macbeth]
The Ghost:
You art nothing!
[Exit Lady Macbeth]
[Enter Lady Macduff]
The Ghost:
You art nothing!
[Exit Lady Macduff]
[Enter Montague]
The Ghost:
You art nothing!
[Exit Montague]
[Enter The Duke of Milan]
The Ghost:
You art nothing!
[Exit The Duke of Milan]
[Enter The Duke of Venice]
The Ghost:
You art nothing!
[Exit The Duke of Venice]
[Exit The Ghost]
Scene IV: Tybalt's assert of Benvolio.
[Enter Tybalt and Benvolio]
Tybalt:
You art as miserable as me!
Scene V: The Ghost answer of Benvolio.
[Exeunt]
[Enter The Ghost and Benvolio]
Benvolio:
Am I better than nothing?
The Ghost:
If not, let us proceed to Let Ghost talk to the rivals.
Benvolio:
You art as good as remainder of the quotient between me and the sum of an
amazing furry mighty animal and a cute chihuahua!
The Ghost:
You art the quotient between yourself and the sum of an smelly fat weak
animal and a stupid chihuahua.
The Ghost:
Am I as normal as a man? If so, we shall proceed to Scene VI. Am I as
normal as honest man? If so, we shall proceed to Scene VII. Am I as normal
as the difference between honest noble king and man? If so, we shall proceed
to Scene VIII. Am I as normal as honest noble man? If so, we shall proceed
to Scene IX. Am I as normal as sum of honest noble king and man? If so, we
shall proceed to Scene X. Am I as normal as sum of honest noble king and
stupid man? If so, we shall proceed to Scene XI. Am I as normal as
difference between honest noble peaceful king and man? If so, we shall
proceed to Scene XII. Am I as normal as honest noble peaceful king? If so,
we shall proceed to Scene XIII. Am I as normal as sum of honest noble
peaceful king and man? If so, we shall proceed to Scene XIV. Am I as normal
as sum of honest noble peaceful king and rich man? If so, we shall proceed
to Scene XV. We must proceed to The Ghost answer of Benvolio.
Scene VI: Ghost insults King Henry.
[Exeunt]
[Enter The Ghost and King Henry]
King Henry:
Am I better than nothing?
The Ghost:
You art stupid man! If so, we must return to Scene II. we must return to
The Ghost answer of Benvolio.
Scene VII: Ghost insults King John.
[Exeunt]
[Enter The Ghost and King John]
King John:
Am I better than nothing?
The Ghost:
You art stupid man! If so, we must return to Scene II. we must return to
The Ghost answer of Benvolio.
Scene VIII: Ghost insults King Lear.
[Exeunt]
[Enter The Ghost and King Lear]
King Lear:
Am I better than nothing?
The Ghost:
You art stupid man! If so, we must return to Scene II. we must return to
The Ghost answer of Benvolio.
Scene IX: Ghost insults King Richard.
[Exeunt]
[Enter The Ghost and King Richard]
King Richard:
Am I better than nothing?
The Ghost:
You art stupid man! If so, we must return to Scene II. we must return to
The Ghost answer of Benvolio.
Scene X: Ghost insults Lady Capulet.
[Exeunt]
[Enter The Ghost and Lady Capulet]
Lady Capulet:
Am I better than nothing?
The Ghost:
You art stupid man! If so, we must return to Scene II. we must return to
The Ghost answer of Benvolio.
Scene XI: Ghost insults Lady Macbeth.
[Exeunt]
[Enter The Ghost and Lady Macbeth]
Lady Macbeth:
Am I better than nothing?
The Ghost:
You art stupid woman! If so, we must return to Scene II. we must return to
The Ghost answer of Benvolio.
Scene XII: Ghost insults Lady Macduff.
[Exeunt]
[Enter The Ghost and Lady Macduff]
Lady Macduff:
Am I better than nothing?
The Ghost:
You art stupid woman! If so, we must return to Scene II. we must return to
The Ghost answer of Benvolio.
Scene XIII: Ghost insults Lady Montague.
[Exeunt]
[Enter The Ghost and Lady Montague]
Montague:
Am I better than nothing?
The Ghost:
You art stupid woman! If so, we must return to Scene II. we must return to
The Ghost answer of Benvolio.
Scene XIV: Ghost insults Duke Milan.
[Exeunt]
[Enter The Ghost and The Duke of Milan]
The Duke of Milan:
Am I better than nothing?
The Ghost:
You art stupid man! If so, we must return to Scene II. we must return to
The Ghost answer of Benvolio.
Scene XV: Ghost insults Duke Venice.
[Exeunt]
[Enter The Ghost and The Duke of Venice]
The Duke of Venice:
Am I better than nothing?
The Ghost:
You art stupid man! If so, we must return to Scene II. we must return to
The Ghost answer of Benvolio.
Scene XVI: Let Ghost talk to the rivals.
[Exeunt]
[Enter The Ghost and Tybalt]
The Ghost:
Open your heart!
[Exit Tybalt]
[Enter Romeo]
The Ghost:
Speak your mind! Let us return to Scene II.
Act IV: The Ending.
Scene I: Exit of all actors and actresses.
[Exeunt]
謝謝大家。
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 73.71.217.229
※ 文章網址: https://www.ptt.cc/bbs/Programming/M.1488616568.A.074.html
※ 編輯: NobleDino (107.77.211.26), 03/04/2017 17:48:11
推
03/04 18:17, , 1F
03/04 18:17, 1F
推
03/04 20:13, , 2F
03/04 20:13, 2F
→
03/05 04:56, , 3F
03/05 04:56, 3F
推
03/05 19:11, , 4F
03/05 19:11, 4F
→
03/06 10:45, , 5F
03/06 10:45, 5F
Programming 近期熱門文章
PTT數位生活區 即時熱門文章