Skip to content

Instantly share code, notes, and snippets.

@raclettes
Last active June 28, 2017 20:43
Show Gist options
  • Save raclettes/ab80a55735b1652b3618dad85e04551e to your computer and use it in GitHub Desktop.
Save raclettes/ab80a55735b1652b3618dad85e04551e to your computer and use it in GitHub Desktop.

Quadrilateral

Template

. . . . . And so on
. . . . . And so on
. . . . . And so on
. . . . . And so on

Cat

> . ? ! \
. . . . .
. . _ . .

order of operations.

> sets the direction, eastward.

. is a no-op

? requests a char input and pushes to stack.

! pops the top value of Stack and pushes character representation.

\ "deflects" the programs pointer, now facing southwestward.

. is a no-op.

_ is like an "angle of incidence-angle of reflection" operator. The pointer is now northwestward.

. is a no-op.

> does the same as the starting position

Direction pointers.

/\_| reflect the direction of the pointer, while <>v^ literally state it. ʌ may be used instead of ^, but is harder to type.

examples.

The number 0-9 are used to represent order.

0 1 2 v
v 4 3 <
> 5 6 v
v 8 7 <
> 9 . .
0 1 2 \
. . 3 .
. 4 . .
| . . .
. 5 . .
. . 6 .
. . . |
. . 7 .
. 8 . .
9 . . .

Number^2

This program squares a number, prints the result, then starts again.

> ¿ & x \
. . . ! .
. . _ . .

Character commands.

Letter/Command Function
? Take character input and push to stack
! Pop the Stack and print the character
¿ Take alphanumerical input and push to stack
¡ Pop the stack and print the number
# Flip the top two stack items
& Pop, then push the value twice
= Pop twice, and if equal push 1, else 0
% Pop twice, do first popped modulo second popped and Push to stack
0-9 Push the relative number to the stack
+ Pop twice, add and then push result
- Pop twice, push first popped minus second popped
* Pop twice, multiply, push to stack
÷ or :, mainly : Pop twice, divide first popped by second popped, push to stack
$ Pop the Stack, then do nothing
@ End the program elsewhere than a column or row overflow
[ Like brainfuck [, unless the instruction pointer is in some way facing east, then it is equivalent to brainfuck's ]
] Like brainfuck ], unless the instruction pointer is in some way facing east, then it is equivalent to brainfuck's [
u Like brainfuck [ if instruction pointer is some way facing south, brainfuck ], otherwise it is brainfuck's ]
n Like brainfuck ] if instruction pointer is some way facing south, brainfuck [, otherwise it is brainfuck's [
" Flip the stack
' Roll the top item of stack to the bottom
; Only at column 1. Comments the line
~ Pop twice, then push a random number between those two including both ends

Trying some more.

So with that knowledge. Let's make a program to print a white space.

3 5 * 2 * 2 + !

Or more creatively:

3 5 * 2 \
. . . * .
. . 2 . .
. > + ! .

Or almost unreadable:

3 5 v . .
. . * . .
. . > 2 \
v 2 * < .
+ . . . .
> ! . . .

Explained

Command Function Stack (-->)
3 Push 3 3
5 Push 5 3, 5
* Multiply 15
2 Push 2 15, 2
* Multiply 30
2 Push 2 30, 2
+ Add 32
! Print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment