We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Talk:155 bytes :D

From Esolang
Jump to navigation Jump to search

this script was used to generate the code:

code0="0a1>b 0b1<a 0c1=# 0d1>d 1a1<b 1b0<c 1c1<d 1d0>a".split()
code1=dict()
symbols="01"
states="abcd"
halt="#"
blank="0"
delimiter="_"
for rule in code0:
  if rule[3]==">":
    for symbol in symbols:
      code1[rule[0]+rule[1]+symbol]=rule[2]+symbol+rule[4]
  elif rule[3]=="=":
    for symbol in symbols:
      code1[rule[0]+rule[1]+symbol]=rule[2]+rule[4]+symbol
  elif rule[3]=="<":
    for symbol in symbols:
      code1[rule[0]+rule[1]+symbol]=rule[4]+rule[2]+symbol
for symbol in symbols:
  for state in states:
    code1[delimiter+state+symbol]=delimiter+blank+state+symbol
    code1[symbol+state+delimiter]=symbol+state+blank+delimiter
    code1[delimiter+state+delimiter]=delimiter+blank+state+blank+delimiter
code2=[]
state_id=dict()
d=(i for i in "abcdefghijklmnopqrsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
def compact_name(s):
  global d,state_id
  if s not in state_id:state_id[s]=next(d)
  return state_id[s]
for symbol in symbols+delimiter:
  code2.append(("",symbol,"s"+symbol,""))
  for symbol2 in symbols+delimiter:
    code2.append(("s"+symbol2,symbol,"s"+symbol,symbol2))
  for state in states:
    code2.append(("s"+symbol,state,"d"+symbol+state,""))
    for symbol2 in symbols+delimiter:
      code2.append(("d"+symbol+state,symbol2,"",code1[symbol+state+symbol2]))
for symbol in symbols:
  code2.append(("s"+symbol,"#",".halt",symbol))
  code2.append((".halt",symbol,".halt",symbol))
code2.append((".halt",delimiter,".rest",""))
code2.append((".rest",delimiter,".rest2",""))
for i in range(len(code2)):
  temp=list(code2[i])
  temp[0]=compact_name(temp[0])
  temp[2]=compact_name(temp[2])
  temp[3]=temp[3][::-1]
  code2[i]=tuple(temp)
code2.sort(key=(lambda x:x[0]))
print("program:")
import random
print(" ".join([l[1]+l[0]+l[2]+l[3] for l in code2]))

--Xyzzy (talk) 07:31, 29 July 2026 (UTC)