the-riviera-kid / tortoise-lang

The Tortoise Language (inspired by an exercise in The Pragmatic Programmer)
0 stars 2 forks source link

Produce program output in Dutch #21

Open the-riviera-kid opened 3 months ago

the-riviera-kid commented 3 months ago

Some Tortoise users have asked for the program's output to be in Dutch. For instance:

D
E 1
-----
1. PEN OMLAAG
2. Trek een lijn 1 eenheid naar het oosten.

Bear in mind this only affects the program's output, not its input. The Tortoise source code remains the same.

The interpreter should support both modes. Add a command line option, --renderer RENDERER. 'RENDERER' is the name of the renderer you want to use. For instance:

python tortoise.py --renderer english tiny.tortoise

python tortoise.py medium.tortoise --renderer dutch

If the renderer is not specified, assume English.

As you might guess, this ticket is a dry run for adding actual drawing capabilities to our interpreter. We want to be able to choose how we draw when we start the program. So, think ahead a little bit. Don't just change the pen_down() function to read return "PEN DOWN" if is_english else "PEN OMLAAG". Think of a nice way to keep all the English functions together, and all the Dutch functions together, and choose which set you are going to use at runtime. Hint: OOP.