Posthumousfuck
Jump to navigation
Jump to search
Posthumousfuck is just Brainfuck with posthumous names as its code.
Command Table
| Posthumousfuck | Brainfuck |
|---|---|
| 文 | > |
| 武 | < |
| 德 | + |
| 景 | - |
| 殇 | , |
| 纣 | . |
| 怀 | [ |
| 炀 | ] |
Example
Hello, world
德德德德德德德德怀文德德德德德 德德德武景炀文德德德德德德德德 纣文德德德德德德德德怀文德德德 德德德德德德德德德武景炀文德德 德德德纣德德德德德德德纣纣德德 德纣文德德德德德德德德怀文德德 德德德武景炀文德德德德纣景景景 景景景景景景景景景纣武武武武德 德德德德德德德德德德德德德德纣 文文纣德德德纣景景景景景景纣景 景景景景景景景纣文文德纣
Implementation
Implementation in Python:
import sys
def hzfsck(code):
s=[]
matches={}
tape=[0]*1000000
for i,j in enumerate(code):
if j=='怀':
s.append(i)
if j=='炀':
m=s.pop()
matches[m]=i
matches[i]=m
cp=0
p=0
while cp<len(code):
if code[cp]=='德':
tape[p]=(tape[p]+1)%256
if code[cp]=='景':
tape[p]=(tape[p]-1)%256
if code[cp]=='殇':
c=sys.stdin.read(1)
tape[p]=(ord(c) if c else 0)%256
if code[cp]=='纣':
print(chr(tape[p]),end='')
if code[cp]=='武':
p-=1
if code[cp]=='文':
p+=1
if code[cp]=='怀':
if not tape[p]:
cp=matches[cp]
if code[cp]=='殇':
if tape[p]:
cp=matches[cp]
cp+=1
hzfsck(sys.stdin.read())