How does "Hello World" work in Shakespeare Programming Language?
Asked Answered
T

1

6

Today while browsing Code Golf, I discovered a language based on Shakespeare known as the Shakespeare Programming Language (SPL).

While trying to understand how the language worked, I came across the Wikipedia entry for SPL, which included example code for the "Standard 'Hello World' program", and I'm having a hard time understanding how this code works.

How does this code in Shakespeare Programming Language print 'Hello World'?

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.

                   Act I: Hamlet's insults and flattery.
                   Scene I: The insulting of Romeo.
[Enter Hamlet and Romeo]
Hamlet:
You lying stupid fatherless big smelly half-witted coward! You are as
stupid as the difference between a handsome rich brave hero and thyself!
Speak your mind!
You are as brave as the sum of your fat little stuffed misused dusty
old rotten codpiece and a beautiful fair warm peaceful sunny summer's
day. You are as healthy as the difference between the sum of the
sweetest reddest rose and my father and yourself! Speak your mind!
You are as cowardly as the sum of yourself and the difference
between a big mighty proud kingdom and a horse. Speak your mind.
Speak your mind!
[Exit Romeo]
                   Scene II: The praising of Juliet.
[Enter Juliet]
Hamlet:
Thou art as sweet as the sum of the sum of Romeo and his horse and his
black cat! Speak thy mind!
[Exit Juliet]
                   Scene III: The praising of Ophelia.
[Enter Ophelia]
Hamlet:
Thou art as lovely as the product of a large rural town and my amazing
bottomless embroidered purse. Speak thy mind!
Thou art as loving as the product of the bluest clearest sweetest sky
and the sum of a squirrel and a white horse. Thou art as beautiful as
the difference between Juliet and thyself. Speak thy mind!
[Exeunt Ophelia and Hamlet]

                   Act II: Behind Hamlet's back.
                   Scene I: Romeo and Juliet's conversation.
[Enter Romeo and Juliet]
Romeo:
Speak your mind. You are as worried as the sum of yourself and the
difference between my small smooth hamster and my nose. Speak your
mind!
Juliet:
Speak YOUR mind! You are as bad as Hamlet! You are as small as the
difference between the square of the difference between my little pony
and your big hairy hound and the cube of your sorry little
codpiece. Speak your mind!
[Exit Romeo]
                   Scene II: Juliet and Ophelia's conversation.
[Enter Ophelia]
Juliet:
Thou art as good as the quotient between Romeo and the sum of a small
furry animal and a leech. Speak your mind!
Ophelia:
Thou art as disgusting as the quotient between Romeo and twice the
difference between a mistletoe and an oozing infected blister! Speak
your mind!
[Exeunt]
Thyrotoxicosis answered 19/7, 2017 at 15:14 Comment(2)
The authors of SPL actually answer just this question in their official document on the language: shakespearelang.sourceforge.net/report/shakespeare/…Janinajanine
Note that Stack Overflow's scope is limited to practical, answerable questions, and that we require each question to be focused on a narrow, specific issue. That applies to "explain this code" requests as well -- they should set out exactly what is and isn't understood, keeping the latter as narrow as possible. See How to handle "Explain how ${this code dump} works" questions on Meta Stack Overflow. Also, Stack Overflow: Where We Hate FunInterchange
T
0

I believe that your code is a bit wrong. Here is the Hello World code in Shakespeare Programming Langauge:

The tempestuous ocean.
Romeo, a young man with remarkable patience.
Juliet, a likewise young woman of remarkable grace.

Act I: The setup.
Scene I: The beginning.
[Exeunt]

Act II: Printing "Hello, World!"
Scene I: Setup for printing.
Romeo: Listen to thy heart!

Scene II: The printing loop.
Juliet: Am I better than you? If not, let us proceed to scene III.
Romeo: Open your heart.

Scene III: Print the character.
Juliet: Open your heart.
Romeo: Is the quotient between the sum of a big big big big big big big big big big big big big big big big big big big big big big big big big big big big big number and a big big big big big big big big big big big big big big big big big big big big big big big big big big big big big number and a big big big big big big big big big big big big big big big big big big big big big big big big big big big big big number nicer than the sum of yourself and a big big big big big big big big big big big big big big big big big big big big big big big big big big big big big number? If so, let us proceed to scene IV.
Juliet: Speak your mind!

Scene IV: Repeat the printing loop.
Romeo: Open your mind.

Scene V: Done printing.
[Exeunt]

And here is the explanation to that code:

The play starts with "The tempestuous ocean," which is just a placeholder to indicate the beginning. "Romeo" and "Juliet" are characters used to represent variables. Acts and scenes are used to structure the program. In Act I, Scene I, [Exeunt] indicates the end of the setup. Act II, Scene I, sets up the printing process. Act II, Scene II, is a loop where Juliet questions Romeo's worthiness. The loop continues until a condition is met. Act II, Scene III, prints characters based on a complex condition involving arithmetic operations. Act II, Scene IV, continues the loop. Act II, Scene V, indicates the end of printing. The program concludes.

Turbinal answered 22/8, 2023 at 23:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.