Strict Standards: Non-static method Soojung::addReferer() should not be called statically in /home/lifthrasiir/sites/ on line 79

Warning: Cannot modify header information - headers already sent by (output started at /home/lifthrasiir/sites/ in /home/lifthrasiir/sites/ on line 63

Strict Standards: Non-static method Entry::getEntry() should not be called statically in /home/lifthrasiir/sites/ on line 51

Strict Standards: Non-static method Soojung::entryIdToFilename() should not be called statically in /home/lifthrasiir/sites/ on line 182

Strict Standards: Non-static method Soojung::queryFilenameMatch() should not be called statically in /home/lifthrasiir/sites/ on line 55
TokigunStudio3 | 블로그: 4줄짜리 파이썬 Brainfuck 인터프리터

내용으로 바로 넘어 가기


1 / 3283   

더 이상 이 블로그는 운영되지 않습니다. 새 블로그로 가 주세요.

4줄짜리 파이썬 Brainfuck 인터프리터

2004/11/19 PM 09:30 | 개발/obfuscation | 0 comments | 0 trackbacks | AllBlog: vote, to pocket

여기서 받을 수 있다. curses 버전과 msvcrt 버전이 따로 있으니 필요한 버전을 쓰면 된다. :)

# for msvcrt
def bf(s):exec"from msvcrt import*;p=q=d=n=0;x={};l=[]\nwhile p<len(s):\n if d:d+={'[':1,']':-1}.get(s[p],0zin'+-':n+=44-ord(s[p]zin'<>':x[q]=n;q+=ord(s[p])-61;n=x.get(q,0z=='.':putch(chr(n)z==',':n=ord(getche()z=='[':d,=(n and[l.append(p)]or[1]z==']':p=l.pop()-1\n p+=1".replace('z','\n elif s[p]')#tokigun20041119:)

# for curses
def bf(s):exec"from curses import*;u=initscr();p=q=d=n=0;x={};l=[]\nwhile p<len(s):\n if d:d+={'[':1,']':-1}.get(s[p],0zin'+-':n+=44-ord(s[p]zin'<>':x[q]=n;q+=ord(s[p])-61;n=x.get(q,0z=='.':u.echochar(nz==',':n=u.getch(z=='[':d,=(n and[l.append(p)]or[1]z==']':p=l.pop()-1\n p+=1\nendwin()".replace('z',')\n elif s[p]')

TrackBack URL:

Copyright (c) 1995-2005, Kang Seonghoon (Tokigun).