My (better) warrior

G

Guest

Guest
Archived from groups: rec.games.corewar (More info?)

I have been trying this copy process thing, but i tried to copy my
guy, then put a new process where the copy was, but i can't get it to
work. here is the code:

mov 9, @4
mov 7, @3
mov 5, @2
mov 2, @1
mov 2, 45
mov 5, -10
mov 4, 15
add #-3, -2
add #3, -2
add #45, -5
add #45, 1
spl 38
jmp -12
dat #0, #0
 
Archived from groups: rec.games.corewar (More info?)

You may try a silk-engine for doing that (copying the process to another
location). It's not as simple as your warrior, but works really fine.
Look the code below (from Reepicheep, which I am currently learning):


pGo spl 1 , 0
spl 1 , 0
spl 1 , 0

pSilk0 spl @0 , >535
pCopy0 mov }pSilk0 , >pSilk0
dat #1 , #1 ; your code on this line
dat #1 , #1 ; your code on this line
dat #1 , #1 ; your code on this line
dat #1 , #1 ; your code on this line
dat #1 , #1 ; your code on this line
dat #1 , #1 ; your code on this line

You see, the first three spl intructions create 8 parallel processes on
the pSilk0 line. Then, the pSilk0 line will be executed 8 times
(creating 8 new processes 535 cells ahead). Just after that, the line
pCopy0 will be executed 8 times (copying the 8 lines of code starting
from pSilk0 535 cells ahead). You'll have to spend some time on those
two lines to understand its workings clearly.

After understanding how the silk-engine works, you should change the

dat #1, #1

lines to whatever you see fit.

That's just a suggestion; anyway, understanding those two lines might
give you some ideas on fixing your code (like pos-incrementing the 45
field). My explanation may be wrong, as I'm a beginner like you. Let's
wait for the veterans. ;-)

I think I like replicators most!

--
Ítalo Cunha,
só no Hyper Threading.

Chris Lukas wrote:
> I have been trying this copy process thing, but i tried to copy my
> guy, then put a new process where the copy was, but i can't get it to
> work. here is the code:
>
> mov 9, @4
> mov 7, @3
> mov 5, @2
> mov 2, @1
> mov 2, 45
> mov 5, -10
> mov 4, 15
> add #-3, -2
> add #3, -2
> add #45, -5
> add #45, 1
> spl 38
> jmp -12
> dat #0, #0
 
Archived from groups: rec.games.corewar (More info?)

cj_lukas@hotmail.com (Chris Lukas) wrote in message news:<99b21fb3.0404151627.2b83379a@posting.google.com>...
> I have been trying this copy process thing, but i tried to copy my
> guy, then put a new process where the copy was, but i can't get it to
> work. here is the code:
>
> mov 9, @4
> mov 7, @3
> mov 5, @2
> mov 2, @1
> mov 2, 45
> mov 5, -10
> mov 4, 15
> add #-3, -2
> add #3, -2
> add #45, -5
> add #45, 1
> spl 38
> jmp -12
> dat #0, #0

I think i would be easier for you to take a look at a low-process
replicator. These kind of papers use an easy single process copy
routine:

pdist equ 936
pinit equ 4080

src: mov #8,#8
add.a #pdist,dst
copy: mov <src,{dst
mov <src,{dst
jmn copy,src
spl src,<1100
dst: jmz pinit,*0
dat }1,>1
end copy

Neogryzor