Deadfish with gotos and input
Jump to navigation
Jump to search
- This language is a derivative of Deadfish.
made by Fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff (talk) 01:46, 3 September 2024 (UTC)
. jumps to instruction accumulator , input h halt c output char
goto 0 if at 256
Programs
Truth-machine
,iiiis. soh ddddddddddddddddddddddddoiiiiiiiiiiiiiiiiiiiiiiii.
Hello, World!
iiisdsiiiiiiiiciiiiiiiiiiiiiiiiiiiiiiiiiiiiiciiiiiiicciiicdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddcddddddddddddcdddddddddddddddddddddsddcddddddddciiicddddddcddddddddc
Interpreter
Written in Python.
def dwgai(program): accumulator = 0 i = 0 while i < len(program): if program[i] == "i": accumulator += 1 elif program[i] == "d": accumulator -= 1 elif program[i] == "s": accumulator *= accumulator elif program[i] == "o": print(accumulator) elif program[i] == ".": i = accumulator elif program[i] == ",": accumulator = int(input("Enter a non-negative integer: ")) if accumulator < 0: accumulator = 0 elif program[i] == "h": return elif program[i] == "c": print(end=chr(accumulator)) if accumulator == -1 or accumulator == 256: accumulator = 0 i += 1 if i == 256 and i < len(program): i = 0
Shorter Version:
def dwgai(p): a,i=0,0 while 1: if p[i]=="i":a+=1 if p[i]=="d":a-=1 if p[i]=="s":a*=a if p[i]=="o":print(a) if p[i]==".":i=a if p[i]==",":a=int(input()) if (p[i]=="h")|(i>len(p)-2):return if p[i]=="c":print(end=chr(a)) if a in [-1,256]:a=0 i+=1 if i==256:i=0