TheSquare

From Esolang
Jump to navigation Jump to search

TheSquare is an esoteric programming language made by Ben Russell in 2006 which is inspired by Befunge.

Specification

Tasks & Memory

There is 32KB of shared RAM between the tasks.

There are 256 potential tasks with:

  • x and y position
  • direction
  • pointer to wherever it is in the 32KB memory given

Each task is allocated 128 bytes of the 32KB given; this is just so that it doesn't collide with other tasks.

If you make an interpreter that supports more than 256 tasks, please make sure that the memory size is at least 128*(number of tasks).

Commands

Movement

  • # - wall, programs bounce off
  • > - move right
  • v - move down
  • < - move left
  • ^ - move up
  • ] - rotate clockwise
  • [ - rotate counter-clockwise
  • J - jump over next instruction
  • L - leap: leap to next leap

Signals:

  • ; - jolt, produce that value at jolt at other end, then bounce off
  • : - unjolt, obtain that value at unjolt at other end, then bounce off
  • | - combined jolt/unjolt, hitting it just bounces you back
  • D - display; these show on the screen after a jolt or unjolt through one
    • a jolt makes it print from the task
    • an unjolt makes it print to the task
    • an unjolt will still pick up a value
  • K - keyboard access
    • one of these at the end of an unjolt will do a getch()

Calculations

  • + - increment accumulator
  • - - decrement accumulator
  • { - if nonzero go left
  • } - if nonzero go right
  • \ - same as BF's <
  • / - same as BF's >

Tasks

  • & - start new task on other end and bounce off
  • @ - kill the task

Examples

Hello World

This actually prints it in caps.

v#############@
+:DDDDDDDDDDD:[
+#;;;;;;;;;;;#
+              
+ ;;
+  >v      ;
+ JJ+      >v
+>^-+      J-
+/--+      --
v{>[<;;    --
/- +  >v;  --
+\ +;JJ+>v --
++ +>^++J- --
++ +J++++-;--
++ >^>^++->^-
++     ++-Jv<
>^     >^-+ ;
#      v-<+>[ ^
#      - ;+
#      >-[^

External resources