Talk:Godencode
Jump to navigation
Jump to search
I'm bad at creating interpreters, but I was able to at least take a file with Godencode data and turn it into a list of commands using Python. Here's the code:
import binascii
code=open(r'file directory')
#Creating a list of values
lines = []
newNum = True
for char in code.read():
if char in ['0','1','2','3','4','5','6','7','8','9']:
if newNum==True:
lines.append(char)
newNum=False
else:
lines[-1] += char
else:
newNum=True
for line in range(len(lines)):
lines[line]=int(lines[line])
#Function that decodes a number into a list of operations
def decode(line,runlist):
i = 2
run = 0
while i * i <= line:
if line % i:
runlist.append(run)
i += 1
run = 0
else:
run += 1
line //= i
runlist.append(run+1)
return runs
#Turning list into commands
runs = []
for line in lines:
decode(line,runs)
I just need a way to actually run the commands (mostly with the bracket commands), and I was wondering if someone could help finish the interpreter. Thanks! -Plasmath (talk) 23:05, 12 June 2021 (UTC)