Paintfuck

From Esolang
Revision as of 13:04, 30 November 2008 by Pgimeno (talk | contribs) (Link to the author's name and other small changes.)
Jump to navigation Jump to search

A borderline-esoteric graphical programming language by Wouter Visser. A deriative from Smallfuck that uses a 2D datagrid instead of 1D.

The commands are:

  • n - Move data pointer north (up).
  • s - Move data pointer south (down).
  • e - Move data pointer east (right).
  • w - Move data pointer west (left).
  • * - Flip current cell.
  • [ - If cell is 0, jump past matching ].
  • ] - Jump to matching [.

The spec stipulates that any letter not among these should be ignored.

The output of the program is the 2D grid itself, best as animation while the program is performing, but possibly a picture of the grid after a certain amount of iterations.

In current implementations the data area and therefore the output canvas is limited, with toroidal (i.e. wrapping) behaviour.

Sample Programs

White screen:

  *[s[e]*]

Fibonacci sequence:

  *
  [[s*en]
  sw[w]enn
  [[e]w*w[w]ess[e]*[w]enn]
  ss]

Automata rule 110 (by oklokok):

   ww*ees*
   [
   e*[*
   w
   ss*nnn[ss*s*s*nnnn*]ssss[*nnnn*ssss]nnne
   ss*nnn[ss*s*s*nnnn*]ssss[*nnnn*ssss]nnne
   ss*nnn[ss*s*s*nnnn*]ssss[*nnnn*ssss]nnnw
   sw
   [*e[*es[*nnw*ess]nw]
     s[*en[*nw*es]sw]nw]
   s
   [*en[*n*s]
     s[*en[*nw*es]sw]w]
   n[*]e[*]e[*]s[*]w[*]w[*]
   nne
   e*]s*
   ]

Langton's Ant (by Pedro Gimeno)

 *[*
   ee[*w[w*s*ne*]w*[e*w*]s[*een*s]n*[*s*nww]ee]ww
   *ee[wws*w*enee*]wwsw[enee*wwsw*]e[*n[*]s]
   ee[ww*w*eee*]www[*eee*www]e[*n[*]s]
   e[w*w*ee*]ww[*ee*ww]e[*n[*]s]
   n[*e[w*s*ne*]w*[e*w*]s[*s*es*w]n*[*eenn*ww]]
   ees[*nw[w*s*ne*]w*[e*w*]s[*nnn*ee*sww]n*[*esss*nw]ees]nww
   es[*n[w*s*ne*]w*[e*w*]s[wwn*s]n*[*ee]es]nw
 *]


Computational class

As it trivially includes Smallfuck, the language is Turing-complete over an infinite grid. If given a finite grid as in the prototype interpreter, it acts like a finite state machine.

External resources