<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Oleg Merkulov</title>
    <description>The latest articles on DEV Community by Oleg Merkulov (@oleg_merkulov).</description>
    <link>https://dev.to/oleg_merkulov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4123542%2Fde18ff8a-8f8e-4cfa-91ba-8e60597993d3.jpg</url>
      <title>DEV Community: Oleg Merkulov</title>
      <link>https://dev.to/oleg_merkulov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oleg_merkulov"/>
    <language>en</language>
    <item>
      <title>A Turing Machine in Minecraft</title>
      <dc:creator>Oleg Merkulov</dc:creator>
      <pubDate>Sun, 13 Sep 2026 19:51:01 +0000</pubDate>
      <link>https://dev.to/oleg_merkulov/a-turing-machine-in-minecraft-2120</link>
      <guid>https://dev.to/oleg_merkulov/a-turing-machine-in-minecraft-2120</guid>
      <description>&lt;p&gt;&lt;em&gt;This is an English translation of &lt;a href="https://habr.com/ru/articles/1016582/" rel="noopener noreferrer"&gt;my original article on Habr&lt;/a&gt;, originally published in Russian.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A Turing machine is one of the fundamental models in computer science. I've been playing Minecraft for more than 12 years and have built all kinds of mechanisms in the game. After years of university study and working in the industry, I had an idea: combine my hobby with fundamental theory, build a Turing machine using Minecraft's mechanics, and share the result.&lt;/p&gt;

&lt;p&gt;A Turing machine has three basic components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tape:&lt;/strong&gt; a sequence of consecutive cells—infinite in the theoretical model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Head:&lt;/strong&gt; a read/write device positioned over the current tape cell.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transition table:&lt;/strong&gt; the machine's program, expressed as a formal set of instructions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Detailed explanations of Turing machine theory are easy to find, so I'll focus on the implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Redstone: the basis of the simulation
&lt;/h2&gt;

&lt;p&gt;Minecraft has a built-in system for simulating electrical signals: redstone. Let's go over its basic building blocks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Signals and power levels
&lt;/h3&gt;

&lt;p&gt;A redstone signal has 16 power levels, from 0 (no signal) to 15 (maximum strength). Redstone dust carries a signal for up to 15 blocks, losing one power level per block.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wiring.&lt;/strong&gt; Redstone dust is the main signal conductor. It automatically connects to neighboring dust, blocks, and components to form circuits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key components
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Redstone torch:&lt;/strong&gt; an inverting source. It is on by default and turns off when the block it is attached to receives power. It is effectively a NOT gate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lever:&lt;/strong&gt; when switched on, it fully powers the block it is attached to, providing a steady signal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Button:&lt;/strong&gt; similar to a lever, but produces a pulse of fixed duration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeater:&lt;/strong&gt; restores a signal to full strength, passes it in only one direction, and introduces a delay of 1–4 redstone ticks. It is essential for long circuits and controlling signal direction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comparator:&lt;/strong&gt; compares two signals. In comparison mode, it passes the main input only when it is greater than or equal to the side input. In subtraction mode, it subtracts the side input from the main input. Comparators are useful for more complex logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Logic gates
&lt;/h3&gt;

&lt;p&gt;Torches, repeaters, and dust can be combined into all the basic logic gates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NOT:&lt;/strong&gt; a torch at the end of a wire inverts the signal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AND:&lt;/strong&gt; two repeaters feed torches whose outputs converge on a single block with an output torch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OR:&lt;/strong&gt; two wires merge into one; the output is active if at least one input is active.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAND / NOR:&lt;/strong&gt; combinations of the gates above.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These primitives form the larger parts of the machine: tape memory, head logic, and the state table.&lt;/p&gt;

&lt;h3&gt;
  
  
  Alphabet
&lt;/h3&gt;

&lt;p&gt;For convenience, I chose an alphabet of four symbols. This lets me represent 0 and 1, a special blank symbol indicating an empty cell, and one spare value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Memory cell
&lt;/h3&gt;

&lt;p&gt;The memory cell stores data on the tape. It contains four bits and can hold values from 0 to 15. Once activated (Figure 1), it continuously outputs the stored signal—in this example, &lt;strong&gt;0101&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The input section on the left has a reset button beneath the first sign. Four bits are more than this implementation needs; I chose that capacity with future extensions in mind.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4jp6dhszl7oct088c1lg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4jp6dhszl7oct088c1lg.png" alt="Memory cell" width="800" height="427"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 1. Memory cell&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Shift register
&lt;/h3&gt;

&lt;p&gt;To select one of several memory cells, the machine needs a shift register. It has a row of lamps: the lit lamp indicates the cell the head points to.&lt;/p&gt;

&lt;p&gt;On the right, below the signs in Figure 2, there are three buttons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Move the head one cell to the left.&lt;/li&gt;
&lt;li&gt;Move the head one cell to the right.&lt;/li&gt;
&lt;li&gt;Reset the shift register to its initial position.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the initial position, the leftmost lamp is on.&lt;/p&gt;

&lt;p&gt;An optional lamp stands separately on the left. It lights up whenever the shift register finishes a move. This completion signal can be used to minimize delays in the main execution loop while ensuring that each shift has finished. In effect, this mechanism implements a bit-shift operation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8of7ib12t0g0itnagd56.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8of7ib12t0g0itnagd56.png" alt="Shift register" width="800" height="427"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 2. Shift register&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Program cell
&lt;/h3&gt;

&lt;p&gt;A program cell is the basic storage unit of the transition table. It holds ten bits of information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The first four bits&lt;/strong&gt; specify the value to write to the tape cell currently selected by the head.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The next two bits&lt;/strong&gt; specify the head movement: &lt;strong&gt;10&lt;/strong&gt; means left, and &lt;strong&gt;01&lt;/strong&gt; means right. The cell shown in Figure 3 is configured to move left.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The final four bits&lt;/strong&gt; specify the next state, entered after the head moves. Again, four bits are more than needed here, but leave room for future extensions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a program cell is executed, it first writes a value to the tape, then moves the head, and finally switches to the selected state.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu7bfxva45gv419ymjovu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu7bfxva45gv419ymjovu.png" alt="Program cell" width="800" height="426"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 3. Program cell&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Binary-to-decimal decoder
&lt;/h3&gt;

&lt;p&gt;The program is encoded in binary, so the machine needs a way to select physical components using binary values. This decoder is optional, but greatly simplifies both the logic and the construction of the Turing machine.&lt;/p&gt;

&lt;p&gt;In Figure 4, a binary number is supplied on the right—in this case, &lt;strong&gt;10&lt;/strong&gt;. The output on the left indicates the corresponding decimal value: 2.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2r1zfo4wevvm8qi8nn0e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2r1zfo4wevvm8qi8nn0e.png" alt="Binary-to-decimal decoder" width="800" height="425"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 4. Binary-to-decimal decoder&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Execution cycle
&lt;/h3&gt;

&lt;p&gt;The machine starts with its execution loop. The loop uses fixed delays between operations on its components. For example: read a cell, wait two seconds; write to a cell, wait two seconds; and so on.&lt;/p&gt;

&lt;p&gt;The components are not wired into a completion-signaling system. If the loop sends a command to move the head right, it does not receive a signal telling it exactly when that operation finishes. There is no particular technical obstacle to adding this; I used fixed delays to get a working result sooner.&lt;/p&gt;

&lt;p&gt;The overall sequence is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start the machine.&lt;/li&gt;
&lt;li&gt;Read the symbol in the current memory cell.&lt;/li&gt;
&lt;li&gt;Look up the transition using the current state and the symbol read from the tape.&lt;/li&gt;
&lt;li&gt;Write the value from the transition table to the current cell.&lt;/li&gt;
&lt;li&gt;Move the head.&lt;/li&gt;
&lt;li&gt;Switch to the next state.&lt;/li&gt;
&lt;li&gt;If the state is empty, send a signal to stop the execution loop. Otherwise, return to step 2.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After assembling all the components and connecting the necessary lines, we have a Turing machine in Minecraft.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8bqfpwfyhjjeqgc00wrt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8bqfpwfyhjjeqgc00wrt.png" alt="The Turing machine in Minecraft" width="800" height="427"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 5. The Turing machine in Minecraft&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Viewed from above, the mechanism's individual components are easier to examine in action.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxm5xvkr7r8g7g9v98t2o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxm5xvkr7r8g7g9v98t2o.png" alt="Top view of the Turing machine" width="800" height="428"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 6. Top view of the Turing machine&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The numbered components are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The encoded program:&lt;/strong&gt; four states, including one halting state, and four alphabet symbols, including the blank symbol, ε. The build contains 20 basic program cells.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The tape:&lt;/strong&gt; eight memory cells, for a total of 32 bits of tape memory.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The shift register.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The execution loop.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The binary-to-decimal decoders.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The orange wire running from component 1 to component 4 carries the halt signal. Entering the halting state triggers this signal and stops the program's execution loop.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsfeiklz7vahq5h4uah9x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsfeiklz7vahq5h4uah9x.png" alt="Main components, viewed from above" width="800" height="428"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 7. Main components, viewed from above&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional views
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F89dqc333h3tfgn2t6w8d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F89dqc333h3tfgn2t6w8d.png" alt="Close-up view" width="800" height="427"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 8. Close-up view&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsney4stxb0768xcu0uaw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsney4stxb0768xcu0uaw.png" alt="View of the execution loop" width="800" height="428"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 9. View of the execution loop&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The result is an interesting, fully functional mechanism implementing a particular instance of a Turing machine. You can &lt;a href="https://www.youtube.com/watch?v=9X8HNgfThac" rel="noopener noreferrer"&gt;watch it in action on YouTube&lt;/a&gt;. The example program increments a number entered on the tape beforehand.&lt;/p&gt;

&lt;p&gt;Play Minecraft and have fun!&lt;/p&gt;




&lt;p&gt;Original article: &lt;a href="https://habr.com/ru/articles/1016582/" rel="noopener noreferrer"&gt;A Turing Machine in Minecraft — Habr (in Russian)&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>minecraft</category>
      <category>computerscience</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
