Nightmare

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Nightmare is a language created by Otesunki (talk).

= intro =

nightmare is inspired by malbolge, ndball, brian & chuck, 
asciidots, and coding job interviews
nightmare progs are placed within an N dimensional grid,
where each dimension has a length of 2.

programs have anywhere between 1 and 10 balls[1], each having a specific start point,
end point, direction, and key[2].

each ball also doubles as a storage unit, containing a binary tree.

on every tick, every ball executes the current instruction[3], encrypts it[4],
updates its key[5], and goes forward one cell in it's current direction[6]

= format =

each line begins with (, followed by a list of
comma seperated (with spaces) balanced ternary numbers (T01),
followed by a ) and a space, and then finally the cell's value.

= instruction reference =

after decrypting, mod 128:

 ins | desc
-----+-------------
  $  | swap branches
     | result: new tree
  #  | invert the tree
     | result: new tree
  +  | construct a new tree, where the old tree is the left branch,
     | and the right branch is empty
     | result: new tree
  -  | traverse down to the left branch of the tree,
     | but remember the other branch
     | result: the right branch of the tree
  ^  | undo -
     | result: new tree
  ?  | if the current tree is empty, set the next ball's key to the current ball's key
     | result: current tree
  ,  | stdin, as an ASCII value, as a surreal number, as a binary tree
     | result: new tree
  .  | same as , but the other way around
     | result: current tree
 n/a | segfault

1 - take the RIPEMD-320 hash of the program, mod 10, plus 1
2 - take each (total amount of balls*2)th character from the source code, and hash.
    start from (ball num) with SHA-512 for the start point,
    (ball num + 1) with SHA-512 for the end point,
    (ball num + 0) with Whirlpool for the direction[2.1],
and (ball num + 1) with Whirlpool for the key.
2.1 - take the start point, find all directions that dont segfault,
      use the hash mod that amount to pick
3 - in order:
- goes forward in it's direction
- finds the instruction it's on
- decodes it
- decrypts it using ECC with the ball's current key
4 - new = AES(key, old)
5 - take the result of the instruction, tack on the current ball's key,
    use the whole thing as the public  key for RSA,
   and encrypt the ball's key with it to form the new key
6 - if any ball goes out of bounds anywhere other than
    its predetermined end space, segfault
7 - trees are hashed by first converting them 
    into <LEFT:RIGHT> format, then hashing that text.