Grusom Skjebne

From Esolang
Jump to: navigation, search

Grusom Skjebne (Norwegian: Cruel Fate) is an esoteric programming language written by User:5k17 in July 2010.

Specification

There are three memory cells which can hold integer values between 0 and 69105, with values exceeding these limits being wrapped; for some operations not the actual values, but their numbers transformed to a string matter. For these, there is a variable Z which specifies which digit is used as their argument. Grusom Skjebne code consists of the digits 0-9, which each signify a certain operation; any other character is treated as an EOF sign.

  • 1 sets cell 0 to a random value.
  • 2 is a conditional statement: the next operation will only be performed if the value of cell 1 is greater than or equal to that of cell 2.
  • 3 subtracts the values of cells 1 and 2 and for a number of times equal to the absolute value of their difference, the initially lower one is increased by one, while the initially higher one is decreased by one. In addition, each time, the operation coded after the "3" is performed. If this is a "2", the condition must be met for one of the following digits in the code per run of the "3" loop.
  • 4 increases the value of Z by one. If Z is greater than the string length of the numeric value of cell 0, it is reset to 0.
  • 5 sets the value of cell 0 to its string length.
  • 6 outputs the Zth digit of the string of cell 0.
  • 7 outputs the ASCII character represented by the value of cell 0 mod 256.
  • 8 exchanges the values in the memory cells, so after the operation, cell 0 has the value of cell 1, cell 1 that of cell 2 and cell 2 that of cell 0.
  • 9 multiplies the value of each cell with that of the following one (cell 2 is multiplied by the value of cell 0).
  • 0 executes the command corresponding to the Zth digit of the string of cell 0. If that digit is 0, this command is ignored.

The commands 1, 5, 6, 8 and 9 also set Z to 0.

External resources