News for hackers. Stuff that matters.
Re:Two Programs Enter, One Program Leaves by alex_h on Tuesday April 19, 2011 @10:58AM (#2462764)
What happens if the instruction pointer for, say, process A, steps into the code space for another process, B? Does the simulator treat it as an illegal instruction causing A to lose? Or does process A continue, but executing B's code?
Re:Two Programs Enter, One Program Leaves by elwin on Tuesday April 19, 2011 @11:49AM (#2462958)
The processes are all in the same code space; there's nothing distinguishing process A's instructions and process B's instructions, so process A would continue executing code created by process B. Some Corewar programs ("vampires") use this to hijack their opponents.
Re:Two Programs Enter, One Program Leaves by kenjackson on Tuesday April 19, 2011 @11:15AM (#2462815)
I think it treats it as a legal instruction.

What I don't get is the replicator strategy. How does replicating yourself help not die? Even if you replicate yourself to all the memory except one address -- but that one address is where your IP is you're screwed. It seems like repairing yourself and attacking the opponent are the only feasible strategies -- at least if I understand correctly.

Re:Two Programs Enter, One Program Leaves by fhars on Tuesday April 19, 2011 @12:08PM (#2463020)
That is what the SPL instruction is for: the program copies its preferably short code to some random location and then splits its execution to continue with both. You are only dead once your last execution pointer hits an illegal instruction.
Re:Two Programs Enter, One Program Leaves by elwin on Tuesday April 19, 2011 @12:04PM (#2463007)
Replicators split into multiple processes, each with its own IP. A program isn't considered dead until all its processes are killed. If one of its processes stumbles across a bad address, the others aren't affected.
Re:Two Programs Enter, One Program Leaves by kenjackson on Tuesday April 19, 2011 @12:11PM (#2463030)
Ah OK, didn't read carefully enough. Thanks.
Re:Two Programs Enter, One Program Leaves by Xk on Tuesday April 19, 2011 @01:02PM (#2463239)
It does not treat it as an illegal instruction. It keeps running their code just fine. This is how Imps fight.

The most basic imp is defined as

   mov 0 1
It copies itself to one instruction ahead of itself. On the off chance it hits the opponents pointer, the opponent becomes an imp too and they both just circle around the core forever.

See elwin's comment below on vampires (for now, hopefully above soon).