5 ms·
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 instruc
by alex_h 15y ago
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?
- kenjackson 15y agoI 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.
- fhars 15y agoThat 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.
- elwin 15y agoReplicators 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.
- kenjackson 15y agoAh OK, didn't read carefully enough. Thanks.
- Xk 15y agoIt 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).
- elwin 15y agoThe 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.