Visify

From Esolang
Jump to navigation Jump to search

Visify is an assembly-like esolang by User:PythonshellDebugwindow that can be used to draw graphics.

Syntax

Visify code is made up of newline-separated commands grouped into blocks by headers. Code under a specific header executes at certain times. Headers start with an = equals sign, and commands use the syntax name arg1 arg2.

Headers

Header Called
=setup At the start of the program
=click When the mouse is clicked
=update Every tick

Commands

arg1 denotes the first argument, and arg2 denotes the second one.

Command Meaning
f Fill the pixel at (X,Y) = (arg1,arg2) (set it to black)
e Empty the pixel at (X,Y) = (arg1,arg2) (set it to white)
ve Set the variable arg1 to arg2
jf If arg1 doesn't evaluate to 0, then jump to the 1-indexed arg2th line

Arguments

Command arguments can take any of the following forms:

  • Integer: a base-10 integer
  • Variable: the first character is a $ dollars sign, and the rest of the argument is the variable to get (set with ve)
    • Special variable: if the variable to get is x, return the mouse X, and if the variable to get is y return the mouse Y
  • Logical negation: the first character is a ! exclamation mark, and the rest of the argument is parsed as usual and then logically negated (0 becomes 1, and all other integers become 0)
  • Addition: the argument is split around the + plus sign, and all the split sections are parsed as usual and then added together

Comments

Comments last until end-of-line and are denoted by #, e.g. f $x $y #Fill the pixel under the mouse

Examples

Truth-machine

Instead of waiting for input from the keyboard, this Truth-machine waits for the mouse to be clicked and uses its X position as input, drawing an infinite line across the screen buffer if the X position is nonzero.

=setup
ve cx 0
=click
jf !$x 7
f $cx 0
ve cx $cx+1

Basic painter

Whenever the mouse is clicked, the pixel at the mouse's position gets filled in (but not erased after).

=click
f $x $y

Computational class

Visify is able to simulate a Minsky machine, as variables can be incremented and decremented and jumps are conditional.

External resources