How to resolve the algorithm Cistercian numerals step by step in the Plain English programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Cistercian numerals step by step in the Plain English programming language

Table of Contents

Problem Statement

Cistercian numerals were used across Europe by Cistercian monks during the Late Medieval Period as an alternative to Roman numerals. They were used to represent base 10 integers from 0 to 9999. All Cistercian numerals begin with a vertical line segment, which by itself represents the number 0. Then, glyphs representing the digits 1 through 9 are optionally added to the four quadrants surrounding the vertical line segment. These glyphs are drawn with vertical and horizontal symmetry about the initial line segment. Each quadrant corresponds to a digit place in the number: Please consult the following image for examples of Cistercian numerals showing each glyph: [1] Due to the inability to upload images to Rosetta Code as of this task's creation, showing output here on this page is not required. However, it is welcomed — especially for text output.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Cistercian numerals step by step in the Plain English programming language

Source code in the plain programming language

To run:
Start up.
Show some example Cistercian numbers.
Wait for the escape key.
Shut down.

To show some example Cistercian numbers:
Put the screen's left plus 1 inch into the context's spot's x.
Clear the screen to the lightest gray color.
Use the black color.
Use the fat pen.
Draw 0.
Draw 1.
Draw 20.
Draw 300.
Draw 4000.
Draw 5555.
Draw 6789.
Draw 9394.
Refresh the screen.

The mirror flag is a flag.

To draw a Cistercian number:
Split the Cistercian number into some thousands and some hundreds and some tens and some ones.
Stroke zero.
Set the mirror flag.
Stroke the ones.
Clear the mirror flag.
Stroke the tens.
Turn around.
Stroke the hundreds.
Set the mirror flag.
Stroke the thousands.
Turn around.
Label the Cistercian number.
Move the context's spot right 1 inch.

To label a Cistercian number:
Save the context.
Move down the half stem plus the small stem.
Imagine a box with the context's spot and the context's spot.
Draw "" then the Cistercian number in the center of the box with the dark gray color.
Restore the context.

Some tens are a number.

Some ones are a number.

To split a number into some thousands and some hundreds and some tens and some ones:
Divide the number by 10 giving a quotient and a remainder.
Put the remainder into the ones.
Divide the quotient by 10 giving another quotient and another remainder.
Put the other remainder into the tens.
Divide the other quotient by 10 giving a third quotient and a third remainder.
Put the third remainder into the hundreds.
Divide the third quotient by 10 giving a fourth quotient and a fourth remainder.
Put the fourth remainder into the thousands.

The small stem is a length equal to 1/6 inch.

The half stem is a length equal to 1/2 inch.

The tail is a length equal to 1/3 inch.

The slanted tail is a length equal to 6/13 inch.

To stroke a number:
Save the context.
If the number is 1, stroke one.
If the number is 2, stroke two.
If the number is 3, stroke three.
If the number is 4, stroke four.
If the number is 5, stroke five.
If the number is 6, stroke six.
If the number is 7, stroke seven.
If the number is 8, stroke eight.
If the number is 9, stroke nine.
Restore the context.

To turn home:
If the mirror flag is set, turn right; exit.
Turn left.

To turn home some fraction of the way:
If the mirror flag is set, turn right the fraction; exit.
Turn left the fraction.

To stroke zero:
Save the context.
Stroke the half stem.
Turn around.
Move the half stem.
Stroke the half stem.
Restore the context.

To stroke one:
Move the half stem.
Turn home.
Stroke the tail.

To stroke two:
Move the small stem.
Turn home.
Stroke the tail.

To stroke three:
Move the half stem.
Turn home 3/8 of the way.
Stroke the slanted tail.

To stroke four:
Move the small stem.
Turn home 1/8 of the way.
Stroke the slanted tail.

To stroke five:
Stroke 1.
Stroke 4.

To stroke six:
Move the half stem.
Turn home.
Move the tail.
Turn home.
Stroke the tail.

To stroke seven:
Stroke 1.
Stroke 6.

To stroke eight:
Stroke 2.
Stroke 6.

To stroke nine:
Stroke 1.
Stroke 8.

  

You may also check:How to resolve the algorithm Arithmetic/Integer step by step in the Plain English programming language
You may also check:How to resolve the algorithm Gapful numbers step by step in the Plain English programming language
You may also check:How to resolve the algorithm Palindrome detection step by step in the Plain English programming language
You may also check:How to resolve the algorithm Substring/Top and tail step by step in the Plain English programming language
You may also check:How to resolve the algorithm Reverse a string step by step in the Plain English programming language