G_arD^EN CorUtY@rD

From Esolang
Jump to navigation Jump to search

G_arD^EN CorUtY@rD (from now on referred to as GC) is a 2-dimensional esolang by User:BoundedBeans that doesn't follow traditional flow control standards.

Playfield

There is a playing field which can be as large as desired, but is limited to the bounding box of the program text. Programs must be a rectangle until the end of the first row containing _, in other words, the newline must always be at the same place. The line after _ first appears, this restriction is removed, allowing comments. The rectangle must only contain valid commands, even if they are never reached. This is to encourage programs to look like a nice garden, although this can of course be circumvented by filling all unnecessary parts with ground bricks.

Symbols

The first line is made of of lowercase and capital x's, for the initial data string. Lowercase represents 0, and Uppercase represents 1. If you don't want it to be as long as the total code width, use a K instead of an x or X, then all characters after it in the first row will be ignored.

# - ground bricks. These do nothing except make the program prettier.
_ - end. when the playing field reader encounters one of these, it stops reading the playing field, replacing the rest of the line with ground bricks. Anything after will be treated as a comment. 
+ - sprinkler. Command: enqueues a 1 into the soil if the front of the soil's queue is 1. Put it into the command queue. Set the pointer direction to right.
~ - hose. Command: enqueues a 0 into the soil if the front of the soil's queue is 1. Put it into the command queue. Set the pointer direction to down.
: - heating vent. Command: dequeues a bit from the soil queue. Put it into the command queue. Set the direction to down.
^v>< - Befunge-style arrows, work normally.
= - soil. Holds a collective queue (all soil shares the same queue). If the command queue is not empty, run a command, otherwise do nothing.
X/x - fence. for visual appeal, and also bounces the pointer backwards.
L - chair. the program starts from the uppermost chair, if tied the leftmost chair, beginning moving right.
- - path. If the front bit is 0, change the direction to right, otherwise, change the direction to down.
E - grill. Output the front bit to the output queue. If the output queue after the previous step is 8 bits long, output an ascii character to STDOUT and clear the output queue. Keep the direction the same.
T - table. Take a bit of input, insert it into the input queue. If the input queue contains 8 bits, enqueue all 8 bits into the main queue. Set the direction to down.

Note: Grill and Table do not go into the command queue, they act on it no matter what.

If the pointer goes off the playing field, restart at the chair. If the queue is empty, halt.

Computational class

As you can probably tell, this can simulate Cyclic tag, making GC Turing-complete. Simply encode the initial state as the X's at the top, then encode the program. If the command is 1, use +, put soil to the right, then the next command to the right of that. If the command is 0 (use ~), or ; (use :), put soil below, then the next command below that.

This never requires arrows (as going off the end of the program restarts, though you can also use left and up arrows to remove going off the end of the program), ground bricks (as programs which use sprinklers, hoses, heating vents, and soil tiles have a predefined path already), fence, path, grill, or table. Also, the soil queue never has to have more than one element, and the initial queue can just be XK(filler)

Formatting

If you think you would like the programs to be a different shape, or use a more complicated path, you can use arrows. For example, to make the program only use 3 columns, you can do something like this (just the skeleton here):

~
=
:
=
:
=
+=v
v<<
~
=
+=v
v<<
+=v
v<<


This also has extra things that aren't in Bitwise Cyclic Tag, like I/O and some nice extra conditional branching using the path (-).


Let's translate starting position 1001, program 10 11 0 0 0 11 (a full valid program)

XxxXKxxxxx
L~########
====+=###x
=+=:+=###x
====+=#==x
===:+=#==x
====+=#==x
===:+=#==x
====+=####
__________


All we really care about is:

XxxX
L~
 =
 +=:
   =
   :
   =
   :
   =+=
_


Notice how we cleverly hide the guts in a beautiful garden setup? This means that is is relatively easy to read bare programs, but it is impossible to write bare programs. There can be kind of a way to make readable and runnable programs:

XxxXKxxxxx
L~########
#=########
#+=:######
###=######
###:######
###=######
###:######
###=+=####
__________

This is kind of cheating, and I recommend keeping the spirit of GC and writing programs which look nice and are runnable. This may undermine reading, so you could make a readable version that comes with it for open source programs (either using the non-runnable bare style, or the ground bricks style). You might even want to hide your source code; this language makes it super easy to obfuscate for anyone who doesn't trace the exact execution!


Programs

Print "Hi":

XKxxxxxxxxxxxxxxxxxx
L~=~=~=~=~=~=~=~=~=x
L=~=~=~=~=~=~=~=~=~x
#+=~###############x
---=-#-#-#-#-#-#-#-x
---~#-#-#-#-#-#-#-#x
---=-#-#-#-#-#-#-#-x
---+=~#############x
-#-#-==============x
-#-#-~===#=#=#=====x
-#-#-=====###======x
-#-#-~===#####=====x
-#-#-=====###======x
-#-#-~===#=#=#=====x
-#-#-==============x
-#-#-+=+=~:::::::::x
-#-#-#-#-=:::::::::x
-#-#-#-#-+=~-------x
-#-#-#-#-#-=:::::::x
-#-#-#-#-#-~:::::::x
-#-#-#-#-#-=:::::::x
-#-#-#-#-#-+=:-:-:-x
-#-#-#-#-#-#-=:-:-:x
#############>EEEEvx
vvvvvvvvvvvvvvEEEE<x
>^>^>^>^>^>^>>EEEEvx
vvvvvvvvvvvvvvEEEE<x
_-_-_-_-_-_-_-_-_-_


All we care about:

X
L~
 =
 +=~
   =
   ~
   =
   +=~
     =
     ~
     =
     ~
     =
     ~
     =
     +=+=~
         =
         +=~
           =
           ~
           =
           +=:
             =
             >EEEEv
             vEEEE<
             >EEEEv
             vEEEE<

Truth-machine:

XKxXxXxxXXxxxxXXXx
LT~~##~~##~~##~~##
xT~~##~~##~~##~~##
xT~~##~~##~~##~~##
xT~~##~~##~~##~~##
xT~~##~~##~~##~~##
xT~~##~~##~~##~~##
xT~~##~~##~~##~~##
xT~~##~~##~~##~~##
x+=::#############
x##==~~#~~###~~#~~
x##::#############
x##==~~#~~###~~#~~
x##::#############
x##==~~#~~###~~#~~
x##::#############
x##==~~#~~###~~#~~
x##::#############
x##==~~#~~###~~#~~
x##::#############
x##==~~#~~###~~#~~
x##::#############
x##==~~#~~###~~#~~
x##::#############
x##==~~#~~###~~#~~
x##--v############
x###v<############
x###:#############
v<<<=:::::::::::::
v###~^^^^^^^^^^^^^
v###=:::::::::::::
v###~^^^^^^^^^^^^^
v###=:::::::::::::
v###+=+=~:^:^:^:^:
>:#^##<==:^:^:^:^:
==#####~~:^:^:^:^:
~~#####==:^:^:^:^:
==#####~~:^:^:^:^:
~~#####==:^:^:^:^:
==#####~~:^:^:^:^:
=+=+=~#==:^:^:^:^:
======#>>EEEEEEEE:
~~##~~#===========
======#>>>>>>>>>>>
~~##~~#===========
^=^=^=^##########<
=+=+=+=+=EEEEEEEE^
__________________

See also

External resources