Note that there are some explanatory texts on larger screens.

plurals
  1. POHelping understanding RedCode
    text
    copied!<p>I'm trying to learn redcode, because it looks fun to make a bot.</p> <h2>Introduction</h2> <p>For those who don't know what redcode is, here's a short explanation. It's an ASM-like language, but far more easy and stripped. It is used to write little programs that need to shut down other programs in virtual memory. (See for more info here: <a href="http://vyznev.net/corewar/guide.html" rel="nofollow noreferrer">http://vyznev.net/corewar/guide.html</a>)</p> <p>Here's a piece of code:</p> <pre><code>;redcode ;name Mice ;author Chip Wendell ;strategy paper (replicator) ;history Winner of the 1986 ICWS tournament Top dat #0, #0 Start mov #12, Top Loop mov @Top, &lt;Target djn Loop, Top spl @Target,0 Spacer equ 653 add #Spacer,Target jmz Start, Top Target dat #0, #833 end Start </code></pre> <h2>Problem</h2> <p>The basic strategy is to replicate itself to another place, and the fork the process. What I don't understand is this rule:</p> <pre><code>Loop mov @Top, &lt;Target </code></pre> <p>I understand the meaning of this line. It says, move the B-Field of target to the line where the B-Field of top points, and decrease the value of the B-Field of target.</p> <p>When loop is executed for the first time, the first line will be:</p> <pre><code>Top dat #0, #12 </code></pre> <p>As far as I get, the line with Loop means: Move the instruction 12 lines ahead (filled with dat #0, #0) to line 833.</p> <p>But when this code is executed, the line of code is placed at line 839.</p> <p>Does someone understand what is happening really?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload