hny021

From Esolang
Jump to navigation Jump to search


hny021
Designed by User:Hakerh400
Appeared in 2021
Computational class Turing complete
Major implementations See below
File extension(s) .txt

hny021 is a Turing-complete esoteric programming language invented by User:Hakerh400 in 2021. It is also the first language ever created in 2021.

Overview

Source code consists of two arrays of natural numbers. Their length must be the same and they must contain at least one element. The first array is called A and the second array is called B.

We internally keep track of three variables:

  • h - Initially 0
  • n - Initially 2
  • y - Initially 1

Perform these steps iteratively until y becomes zero, in which case the program halts:

  1. Let a be the element of A at index h
  2. Let b be the element of B at index h
  3. Increment h by 1 and if it becomes equal to the length of the arrays then reset it to 0
  4. Check if y is odd
  5. Perform integer division y by 2
  6. Perform integer division n by 2
  7. If y was odd then y = y + n * a and n = n * b

Interpreters

Here is a simple interpreter in Python:

A = [6, 1, 5] B = [8, 4, 8] h = 0 n = 2 y = 1 while y: a = A[h] b = B[h] h = h + 1 if h == len(A): h = 0 odd = y & 1 y = y // 2 n = n // 2 if odd: y = y + n * a n = n * b