fork(1) download
  1. #Pass programs to these functions in the form of strings. wf_bf will accept Wordfuck and return Brainfuck while bf_wf
  2. #will accept Brainfuck and return Wordfuck, generated with a list of random words.
  3. def words(s):
  4. result,z=[],s
  5. while len(z)>0:
  6. try:
  7. x=z.index(' ')
  8. result.append(z[:x])
  9. z=z[x+1:]
  10. except:
  11. result.append(z)
  12. z=''
  13. for i in result:
  14. if i=='':
  15. result.remove(i)
  16. return result
  17.  
  18. def wf_bf(s):
  19. table={2:'.',3:'-',4:'+',5:',',6:'>',7:'<',8:'[',9:']'}
  20. z=words(s)
  21. result = ""
  22. for i in z:
  23. if len(i) in [2,3,4,5,6,7,8,9]:
  24. result+=table[len(i)]
  25. return result
  26.  
  27.  
  28. def bf_wf(s):
  29. from random import choice
  30. randomwords=[['it', 'to', 'is', 'or', 'be', 'ye', 'so', 'me', 'he', 'pi', 'do', 'we', 'my'], ['not', 'man', 'and', 'ore', 'try', 'men', 'the', 'you', 'was', 'can', 'bat', 'dry', 'dog', 'ran', 'nor', 'cat', 'thy', 'pit', 'bin', 'box', 'rat', 'mat', 'fat', 'hat', 'ham', 'dam', 'fan', 'joy', 'tin', 'toy', 'gag', 'pan', 'pad', 'pin', 'cry'], ['dart', 'that', 'list', 'once', 'fish', 'leaf', 'pine', 'grin', 'cola', 'loop', 'colt', 'plan', 'pore', 'play', 'nick', 'dent', 'lick'], ['mouse', 'among', 'spike', 'woman', 'women', 'brain', 'novel', 'there', 'named', 'sloth', 'zebra', 'throw', 'foyer', 'lucky', 'horse', 'block', 'truck', 'canal', 'radio', 'break', 'biome'], ['roller', 'sailor', 'botany', 'bonobo', 'portal', 'pocket', 'tactic', 'jumped', 'remote'], ['octopus', 'cranium', 'blanket', 'filings', 'bemused', 'machine', 'sawdust', 'gymnast', 'beastly', 'testify', 'dubious', 'coastal'], ['question', 'critical', 'hospital', 'trifling', 'alphabet', 'lodgings', 'imposter', 'screamer', 'apparent', 'omnivore', 'dramatic', 'dissolve', 'ordinary', 'syllable', 'humanity', 'hydrogen'], ['limousine', 'enlighten', 'vengeance', 'furniture', 'candlelit', 'predicted', 'apathetic', 'statuette', 'climactic', 'allergens', 'dexterity', 'versatile']]
  31. table={'.':2,'-':3,'+':4,',':5,'>':6,'<':7,'[':8,']':9}
  32. result=""
  33. for i in s:
  34. if i in '><+-.,[]':
  35. result+=choice(randomwords[table[i]-2])+" "
  36. return result[:-1]
  37.  
  38. print wf_bf("""Thus men; die. Here meet prepar'd thrice be." Down his
  39. with lab'ring forg'd and And retir'd Now universal Phoebus at
  40. Hesperian living, off fields fierce cries, assail'd not for These
  41. foe. Spread, indulgent quarry headlong prince your bloody side crew.
  42. Elated call humble yield, his yield, boys camp men, cruel
  43. all the loudly trusty won, winter spouts they crown. Had
  44. what long long upon fram'd. Declare back throat, tossing his
  45. enters, the Nor Aeneas; said from flowing the enclose th'
  46. match'd Receive with neither threat. From seas painted His oppos'd,
  47. cried, Thus mortal the his and combine form and, wine.
  48. And but Let absent, sums to guest, you to spear
  49. to greedy of First, with love bear." path Whom heav'n
  50. That by Argive need they to blood, wert eyes the
  51. this To large, with Some Jove (The from hosts, the
  52. yoke with horses' when sail is purple at wintry his
  53. with more camp with have to Earth, to oppose of
  54. the troops with various but so, thirty well perform by
  55. the and waves- man! from fear victory too at fire,
  56. If recess banish'd transfer.""")
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
+++++[>++++[>--<-]<-]<->>>[-->+<]>[>+>+>>+>>->+++>-->>+>>+>+++++<<+<<+<--<++<-<+<<+<<++<-]>+>---<++>---<+.>-.>.>.>++>++<+.>++.>++++.>+++++>+++<++.>.>++++++.>.>-->+<-->+<--->+++<-.>.>[]