KnightJump

From Esolang
Jump to navigation Jump to search

KnightJump is a two-dimensional esoteric programming language created by User:Слон из ЖЕЛЕЗА, where instruction pointer moves like a Knight from chess.

KnightJump
Paradigm(s) procedural
Designed by User:Слон из ЖЕЛЕЗА
Appeared in 2023
Memory system stack
Dimensions two-dimensional
Computational class Unknown
Reference implementation In external resources
File extension(s) "txt"

Execution

There is a stack and the only type is an arbitrarily-sized decimal. Program is like torus: if instruction pointer goes into void, it will appear from other side.Instruction pointer has 8 directions to move:

 n┬N  
W │  E
├─♘─┤
w │  e
 s┴S 

Commands

Version 1.0

Command Description
N,n,E,e,S,s,W,w Changes direction
H Changes direction: (mirror)
N: W,   E: S,
n: E,   e: N,
S: w,   W: s,
s: e,   w: n.
$ DUP
\ SWAP
% DROP
+ Takes two elements from the stack and pushes the sum. (x y -> x+y)
- Takes two elements from the stack and pushes the (second-first). (x y -> x-y)
* Takes two elements from the stack and pushes the product. (x y -> x*y)
/ Takes two elements from the stack and pushes the (second/first). (x y -> x/y)
^ Takes two elements from the stack and pushes the second to the power of first.(x y -> x^y)
> Takes two elements from the stack and if second is greater than first, pushes 0, else pushes 1.
< Takes two elements from the stack and if second is less than first, pushes 0, else pushes 1.
= Takes two elements from the stack and if they are equal, pushes 0, else pushes 1.
; Outputs an element from the stack. (without deleting it)
: Inputs an integer and pushes it to the stack.
? Inputs a character and pushes its code to the stack.
! Outputs a character.
# Takes an element from the stack. Encrypts all the commands.

(By shifting character codes by an element)

~ Stops the encryption.(this instruction does not get encrypted.)
@ Terminates the program.

Version 1.1

Command Description
& Reverses the stack
Every letter except N,n,E,e,S,s,W,w Mirrors, which changes your direction based off previous one. (check mirrorbase.py if you want to know new direction)

Numbers

Numbers are found by the diagonal chain of 0,1,2,3,4,5,6,7,8,9. It can't go to the number it already stepped. Finding next element in chain is done by checking 4 spots in that order:

1  2
 N
4  3

Examples:

 3                ♘ 3                         
2 4               │ 2 4                          0 7
┌1   Number: 1234 └1 7 5   Number: 123456789    1 6 9   Number: 106790
│                   8 6                      ♘─┘5 0
♘                   9                     

External Resources

Implementation