Hito

Hito means 'one' in Japanese. Hito is a one-instruction Turing-complete esoteric programming language created by User:TheCanon2.
Hito was designed because of a critical flaw with the way its sister language Ichi handles input. In Ichi, both registers are overwritten whenever input is grabbed, which makes it impossible to store any permanent data.
==Commands==
Hito has two unbounded registers with addresses 0 and 1. The Hito command accepts only one operand, x.
Change register with address x modulo 2 by the numeric sign of x. If said register is -1, move 1 line forward. Else, goto line absolute of x divided by 2 rounded down.
However, there are three exceptions.
If x is 0 or 1, print the value of register x and unconditionally move 1 line forward.
If x is -1, accept a numeric input to be written to register 0 and unconditionally move 1 line forward.
The latter is the difference between Hito and Ichi; only register 0 is overwritten by input. And unlike Ichi, the -1 instruction isn't baked into every Hito program.
Line numbers start at 1 and increment by 1 for each line in the program. The program halts if the line number is greater than the length of the program.
==Examples==
All Ichi programs not reliant on input are fully compatible with Hito.
===Hello, World!===
5 7 9 11 13 15 17 19 -23 40 24 26 28 30 32 34 36 38 18 -42 0
47 49 51 53 -57 76 58 60 62 64 66 68 70 72 74 52 -78 -80 0
84 86 88 90 92 94 96 0 0 102 104 106 0
111 113 115 117 119 121 123 125 127 -131 -146 -132 -134 -136 -138 -140 -142 -144 -126 -148
-150 0 -154 -156 -158 -160 -162 -164 -166 -168 -170 -172 -174 -176 0
181 183 185 187 189 191 193 195 197 199 -203 214 204 206 208 210 212 198 0
219 221 223 225 227 229 231 -235 242 236 238 240 230 -244 0 248 250 252 0
-256 -258 -260 -262 -264 -266 0 -270 -272 -274 -276 -278 -280 -282 -284 0
289 291 293 295 297 299 301 303 305 -309 -324 -310 -312 -314 -316 -318 -320 -322 -304
-326 -328 0
Prints the ASCII values of the characters in 'Hello, World!' since Hito has no native character I/O.
===Quine===
0
This is the smallest in a set of infinitely many Hito quines with all-zero instructions.
===Truth machine===
-1 -12 8 0 18 14 0 -12
===Cat===
EOF returns 0:
-1 -8 14 10 0 2
EOF returns -1:
-1 6 -10 14 0 2
===XKCD Random Number===
4 6 8 10 0
===A+B problem===
-1 7 -4 -11 -1 14 -13 -18 0
===A-B problem===
-1 7 -4 -11 -1 -15 -12 19 1
===Disan Count===
-1 1 -10 25 -14 25 17 19 -22 25 4
Simplified version in which the "is even!" text is not printed.
===Print all natural numbers===
0 2
===Computational class===
Hito is Turing-complete for it can simulate a two-register Minsky machine.
6 Increment register 0
-8 10 0 Decrement register 0 and jump to instruction 3 unless it is zero in which jump to instruction 4.
==Implementations==
The following Python script is an interpreter.
prgm = input('>Hito ')
prgm = list(prgm.split(" "))
for i in range(0, len(prgm)):
 prgm[i] = int(prgm[i])
prgm.insert(0, -1)
# Initialises registers
cells = [0, 0]
# Executes program
inst = 1
def hito(x):
 global prgm
 global cells
 global inst
 if x == -1:
 cells[0] = 0
 init = input('>i ')
 if len(init) > 0:
 cells[0] = int(init)
 inst += 1
 elif x == 0 or x == 1:
 print(cells[x], end=" ")
 inst += 1
 else:
 cells[x % 2] += int(x / abs(x))
 if cells[x % 2] == -1:
 inst += 1
 else:
 inst = abs(x) // 2
while inst < len(prgm):
 hito(prgm[inst])
This interpreter only supports interactive input. However Hito can also theoretically operate with input sequences, in which the -1 command becomes a Brainfuck comma.
Debugger variant:
…
while inst < len(prgm):
 print("(Perform inst %d on data %s: \'%d\')" % (inst, cells, prgm[inst]))
 hito(prgm[inst])
==See also==
* Ichi
Category:Languages
Category:Turing complete
Category:Turing tarpits
Category:Implemented
Category:OISC
Category:2024