On the Subject of Markscript

Turing complete on the inside, wacky stripes on the outside.

This module is a computer, which itself consists of a screen, a red power button, and a keyboard. When the key is pressed, it will give you a task which will be a description of a program you must write. Executing a program to complete the task provided solves the module. This module will not strike.

While the program is being written, pressing the power button will execute the program. If the program is being executed while it’s pressed, the program will halt instead.

Almost all keyboard keys, including the one shaped like a Z in Tetris, will simply append the character shown on the key to the current line. The exceptions are listed below.

  • : Shows/hides the task. All other controls don’t work while shown.
  • : Removes the final character from the current line. Note that this does not work if the character you are attempting to remove is a ?.
  • , : Moves the cursor to the previous or next line, respectively.

Your real-life keyboard can also be used to type. Letters, space, backspace, and arrow keys always work as expected. Enter and numbers work normally so long as Shift is not held. The table below shows what real-life keys are changed to when Shift is held. Keep NumLock in mind when using the real-life keyboard.

12345678Enter
«

The program will be written in a programming language called, unsurprisingly, Markscript. The complete documentation of which is provided below. All variables presented in the task will be automatically given values before the program is run. The module will solve when the correct output is returned five times in a row. If an incorrect output is returned or the module attempts to execute a line with a syntax error, the screen will display the problem and the program will halt. Press to return to the program while in this state.

Programs in this language will for the most part run each line, in order, from top to bottom. Unless stated otherwise below, after a line is run, the line below it will run after. Exceptions to this are lines that may end up skipping other lines or go to a line backwards or forwards in the program.

Comments are used to help the programmer mark what sections of code do, and are mostly ignored when the program is run. Comments can be added to the end of any line so long as you put an « first. Comments cannot include spaces nor numbers and it’s recommended that the same comment isn’t used more than once. Only one comment is allowed per line.
Syntax: [code] «[comment]
Examples: ♫0 «DONE, ₪STUCK «STUCK, ☼X 21 «INSERTJOKEHERE, STUFF√ «ETCETC

Variables are used to store numerical data within the program which can be used in the future. Variables are assigned by starting a line with a , followed by a name, then after a space give it a numerical value or the name of an already assigned variable. Attempting to assign a new variable with an already existing name will cause an error. Place the after an already made variable’s name instead to change its value. You can also make a number negative by adding a to the front of it. Note that you cannot do so for variable names.
Syntax: √[name] [value]
Examples: √SIX 7, SIX√ 6 «WHOOPS, √COPY ORIGINAL, √NEGATIVEONE ♣1

An If Statement is used to check for if a specific condition is true. If statement can be created by starting a line with , followed by a variable name, then after a space give it the appropriate symbol set corresponding to what you would like to check, followed by the value you would like to compare against. Conditions for less than, equal to, and greater than are , ∩∩, and ♣∩ respectively. If the condition is true, then the next line to be run will be the one two lines below it.
Syntax: ◊[name] [condition][value]
Examples: ◊NUM ∩∩0, ◊HMMM ∩♣10, ◊BIGONE ♣∩MILLION, ◊ANSWER ∩42

A Jump is used to move to different parts of the program. To write a jump, start the line with a , followed by the comment in the line you wish to jump to. If multiple lines have the comment, the topmost is used.
Syntax: ₪[comment]
Examples: ₪TOP, ₪BACK, ₪THATLINE, ₪THINGONE «THINGTWO

Addition is the only operation possible directly in this language. To write one, start the line with a , followed by the variable name, then after a space the value you wish to add. The new value after the addition will automatically be assigned.
Syntax: ☼[name] [value]
Examples: ☼TOOSMALL 100, ☼OFCOURSE THISWORKS, ☼DIM DIM, ☼HINT ♣1

A Return is used in this implementation to exit the program with a specific value as the output. To return, start the line with a , followed by the value you wish to return. An incorrect value being returned will result in an error.
Syntax: ♫[value]
Examples: ♫0, ♫YESVARIABLESWORK, ♫♣1, ♫1 «FINISHED