Villmark (Norwegian: wilderness) is an esoteric programming language designed from 07/2010 to 10/2010 by User:5k17 for the purpose of having a language which, in contrast to many other esolangs, doesn't mainly have commands that do less than the programmer would normally want them to do, but more, or less predictably; specifically, most commands affect and/or depend on more variables than would be reasonable (which would be two, one or, in some cases, zero).
In Villmark, data is stored in 256 memory cells which can hold any integer value; they are initially set to 0. There is always one cell selected, but in difference to most other programming languages, the selected cell is not the only one which can be manipulated, but most commands also change the two cells next to it (referred to as the previous and next here), or even all cells. Cells are not directly selected; instead, there is something called cell flow which indicates by how many cells the selection changes after each command (including loop commands, with both the loop start and end command being counted each time the loop ends/restarts). When a Villmark program is started, the cell flow is 0. If the cell selection goes outside the 0-255 boundary, it will wrap over.
There are 16 commands, represented by half bytes in source code; i. e. when viewing a Villmark file in a hex editor, each hex character (0-F) represents one command. The effects of the commands are:
- 0: The value of the currently selected cell is moved by 1 away from -0.5, i.e. if it is higher than -0.5, it is increased, if it is lower, it is decreased by one. All other memory cells' values are moved by 1 towards -0.5.
- 1: The value of the currently selected cell is moved by 1 towards -0.5, the other cell's values are moved by 1 away from -0.5.
- 2: The values of all cells are mirrored at -0.5.
- 3: The value of the current cell is subtracted from all cells.
- 4: The value of the next cell is added to that of the current, while that of the previous one is subtracted from the current one.
- 5: The value of the next cell is multiplied by that of the current cell; the value of the current cell is divided by that of the previous one. If you divide by zero, this is considered so evil that the current cell's value will be set to 666.
- 6: The values of the current and next cell are swapped. Additionally, if the value of the current one is lower than that of the next, the previous cell's value is moved by 1 away from -0.5, otherwise it is moved by 1 towards -0.5.
- 7: The cell flow is increased by the value of the current cell.
- 8: The cell flow stops.
- 9: The cell flow direction is reversed.
- A: The value of the currently selected cell is randomly either increased or decreased by one.
- B: Accepts input. The value of the previous cell is increased by the ASCII value of this input, multiplied by the value of the next cell.
- C: Starts a loop. Everything in the loop is only executed if, and repeated as long as, the value of the current cell, decreased by the value of the previous cell, is higher than that of the next cell.
- D: Stops a loop. If no loop is currently active, the program is terminated.
- E: Prints the character corresponding to the value of the current cell in ASCII to the screen.
- F: Executes the value of the current cell modulo 16 as a command. If that would be F, this command is ignored.
The following program prints "Hello World!" to the screen. Due to the nature of the language, its hex representation is used here.
F0 06 77 90 81 78 60 07 87 90 18 51 11 67 87 92 28 51 E7 11 11 11 87 81 78 79 18 E0 00 00 00 EE 00 0E 11 11 11 51 11 E7 77 70 87 96 79 11 80 00 00 00 E4 07 70 87 26 28 E0 00 E1 11 11 1E 11 11 11 11 E1 78 44 40 ED