Skip to content

Shakespeare interpreter: division ("the quotient between") fails on any input #2

@FINDarkside

Description

@FINDarkside

Division expressions in the Shakespeare interpreter always fail because the prefix string is sliced incorrectly.

esolang_bench/interpreters/shakespeare.py#L369

expr[22:] should be expr[21:] — the prefix "the quotient between " is 21 characters, not 22. The extra character eats the first letter of the left operand, so yourself becomes ourself and fails with unknown noun in phrase 'ourself'.

Reproduce:

from esolang_bench.interpreters import get_interpreter

program = """
Romeo, a young man.
Juliet, a young woman.

Act I: The only act.
Scene I: The test.
Enter Romeo and Juliet.
Juliet: You are the quotient between yourself and yourself.
Juliet: Open your heart.
Exeunt.
"""

result = get_interpreter("shakespeare").run(program)
print(result.error_type)  # runtime_error
print(result.stderr)      # unknown noun in phrase 'ourself'

Fix: Line 369: expr[22:]expr[21:]

Workaround: Add one extra whitespace after "the quotient between", so 2 spaces in total after it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions