-4
\$\begingroup\$

The goal: write a program that implements a turing-complete system. It could be cellular automata, a tag system, a turing machine, an interpreter for a language of your own design... the type of system doesn't matter as long as it satisfies the following conditions:

  • Takes a "program" from the user as input (ex. the initial state of the turing machine)
  • Runs the program
  • Outputs the state of the system (or just the returns the output of the program)
  • It's possible to compute anything that can be computed with the right input program to your system.

Self-interpreting is forbidden.

As usual entries in the same language that implement the same type of system will be judged by byte count.

For example: programs which implement a universal turing machine in Python will be compared against other programs which implement universal turing machines in Python. The spirit of the challenge is basically the simplest possible programs that can model a turing-complete system.

Because of the diversity of possible programming languages, vote for entries that you believe are clever, elegant, or especially short. The winner will be the entry with the most votes.

\$\endgroup\$

closed as too broad by Peter Taylor, Mego, Dennis Nov 6 '16 at 6:52

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ Would a single eval() be considered forbidden in this challenge? \$\endgroup\$ – Sunny Pun Nov 6 '16 at 5:20
  • \$\begingroup\$ Could you be more specific? \$\endgroup\$ – J. Antonio Perez Nov 6 '16 at 5:22
  • \$\begingroup\$ @JorgePerez Hmm.... I get the feeling people could just copy answers from the "Golf a BrainF**k Intepreter" thread... \$\endgroup\$ – Socratic Phoenix Nov 6 '16 at 5:29
  • 1
    \$\begingroup\$ I don't think the "word and symbol" system is good enough - it may cause ambiguities down the way. Just use byte-count, it should be fine. Also, what SunnyPun meant was a program (in Python, say) in which the code is eval(input()), and the input is valid Python code. That answer is valid under your current terms. \$\endgroup\$ – clismique Nov 6 '16 at 5:39
  • 1
    \$\begingroup\$ Do X creatively popularity contests have fallen out of scope. In addition, asking to implement one choice out of the infinity of Turing complete languages makes this rather broad, and without an objective goal like code size, too broad. By the way, we have a sandbox where you can post challenge ideas and get feedback from the community before "going live". \$\endgroup\$ – Dennis Nov 6 '16 at 6:52
2
\$\begingroup\$

Python 3 for the language ///

A terribly long program, accepts input as a series of lines terminated by a newline and then the EOF character (May be Ctrl-Z or Ctrl-D depending on your OS).

s=''
try:
 while 1:
  s+=input()+'\n'
except:
 pass
try:
 while len(s):
  if'/'==s[0]:
   s=s[1:]
   f=r=''
   while'/'!=s[0]:
    if'\\'==s[0]:
     s=s[1:]
    f+=s[0]
    s=s[1:]
   s=s[1:]
   while'/'!=s[0]:
    if'\\'==s[0]:
     s=s[1:]
    r+=s[0]
    s=s[1:]
   s=s[1:]
   while f in s:
    s=s[:s.index(f)]+r+s[s.index(f)+len(f):]
  elif'\\'==s[0]:
   print(s[1])
   s=s[2:]
  else:
   print(s[0],end='')
   s=s[1:]
except:pass

Try it on Ideone!

It has been slightly golfed.

\$\endgroup\$
  • \$\begingroup\$ Could be golfed more by inlining multiple statements after a colon (e.g. while f in s:s=s[:s.index and elif'\\'==s[0]:print(s[1]);s=s[2:]). \$\endgroup\$ – wizzwizz4 Sep 22 '17 at 16:35
  • \$\begingroup\$ @wizzwizz4 I got your comment; unfortunately I'm not in a position where I can edit easily right now. \$\endgroup\$ – boboquack Sep 22 '17 at 19:54
  • \$\begingroup\$ That's fine. This is the (asynchronous) internet - I can wait! :-) \$\endgroup\$ – wizzwizz4 Sep 22 '17 at 21:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.