Saturday, September 13, 2014

Tileland+ code

Tileland+ interface
Along with an interface update, I added a some language extras.  The native Tileland instructions remain (polygons, colours, and turning) but now I have added the environment instructions to the language.  In particular, I have added clipboard manipulation instructions. Although somewhat hidden, this addition is a metalanguage or a preprocessing language.

It's actually pretty simple when you see an example.  An orange hexagon with a blue square would be 6 o 4 b.  The picture below is a that with a right turn or 6o4b>.  The colour follows the shape so that it has something to colour. Doing that 4 times is just 6o4b>6o4b>6o4b>6o4b>.  Another way to make the pattern is to use the clipboard.  I haven't yet introduced a concept of a cursor yet so the clips come from the entire current code. There are 5 instructions that affect the clipboard: x, v, n, m, and q.  The first, x, simply transfers the current code into the clipboard.  The second, v, adds the first clip to the current code. The next two n and m roll the clips left and right. The final one, q, clears all the clips.  The other letter instruction, z, removes the last chunk from the current code (only really useful in an immediate situation).  So, to make the loop of squares and hexagons using the clipboard you could type 6o4b>xvvvv or cut and paste that into the code textbox. The result of either action is [6o4b>][6o4b>][6o4b>][6o4b>] -- the brackets chunk the code but do not affect the resulting picture.

The code in the Tileland+ image was produced by using 2 different clips -- this required using the n and m instructs to change the first clip back and forth.  For instance, in this code, "6o4>6p>>>4o>x 6o4>x  vvvnvmvnvmvnvv", the first two chunks make the clips and the third chunk use the two clips.  In terms of cutting and pasting sometimes it's best to start with a fresh clipboard so an initial q can make a fresh start -- so q6o4>6p>>>4o>x6o4>xvvvnvmvnvmvnvvmvnvvmvnvvv so  makes the pattern in the image.

Play around with this version of Tileland and tell me what you think.

Popular Posts