A question

G

Guest

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

Nevermind the help of making the forward and backward warrior. i did
it, but is there a way to make it go faster?
;START
mov 5, -1
mov 4, 5
add #-1, -2
add #1, -2
jmp -4
dat #0, #0
;END

Also what is the use of making more than one process and how do you do
it?
 
Archived from groups: rec.games.corewar (More info?)

Chris Lukas wrote:
> Nevermind the help of making the forward and backward warrior. i did
> it, but is there a way to make it go faster?
> ;START
> mov 5, -1
> mov 4, 5
> add #-1, -2
> add #1, -2
> jmp -4
> dat #0, #0
> ;END
>
> Also what is the use of making more than one process and how do you do
> it?

well, using operator modes you could shrink the number of lines down a
bit (used for bombing) and add a spl to create more processes executing
the bombing loop (also used as step-storage). if you attach a djn stream
oh well.. the stepsize is not optimal btw.. atm you are doing a twoway
clear, bombing every location in a linear pattern. however, since most
warriors occupy more space than just a single cell, you can gain a
significant efficiency gain by choosing a bigger step.

as for processes.. that question has been answered already multiple
times. they make a warrior harder to kill as all processes have to be
eliminated... see spl. in this case, every location inside the warrior
except for the spl could be dat-bombed without killing it. (because the
spl continues generating new processes..)

step spl #1, #-1
mov bomb, @bomb
mov bomb, *bomb
add.f step, bomb
djn.f -3, <-1200
bomb dat #1, #ptr-1
 
Archived from groups: rec.games.corewar (More info?)

Andreas Scholta <brx_one@phreaker.net> wrote in message news:<c5grem$qm6$02$2@news.t-online.com>...
> Chris Lukas wrote:
> > Nevermind the help of making the forward and backward warrior. i did
> > it, but is there a way to make it go faster?
> > ;START
> > mov 5, -1
> > mov 4, 5
> > add #-1, -2
> > add #1, -2
> > jmp -4
> > dat #0, #0
> > ;END
> >
> > Also what is the use of making more than one process and how do you do
> > it?
>
> well, using operator modes you could shrink the number of lines down a
> bit (used for bombing) and add a spl to create more processes executing
> the bombing loop (also used as step-storage). if you attach a djn stream
> oh well.. the stepsize is not optimal btw.. atm you are doing a twoway
> clear, bombing every location in a linear pattern. however, since most
> warriors occupy more space than just a single cell, you can gain a
> significant efficiency gain by choosing a bigger step.
>
> as for processes.. that question has been answered already multiple
> times. they make a warrior harder to kill as all processes have to be
> eliminated... see spl. in this case, every location inside the warrior
> except for the spl could be dat-bombed without killing it. (because the
> spl continues generating new processes..)
>
> step spl #1, #-1
> mov bomb, @bomb
> mov bomb, *bomb
> add.f step, bomb
> djn.f -3, <-1200
> bomb dat #1, #ptr-1

Thanks so much. I have a few questions in reply to your answer. (btw,
i didn't learn all the commands yet, i just know the simpler ones like
jmp, dat, add, etc.)

whats an spl? i will look it up, but the beginner's guide doesn't
explain most things well enough for me to understand. (i don't blame
the author... im 13)

whats a djn stream? I will also try to look this up

what is an optimal step size? 3 or 4? (just guessing)

what is the add.f and djn.f?
 
Archived from groups: rec.games.corewar (More info?)

Chris Lukas wrote:
> Thanks so much.
<snip>

np.

> whats an spl?

spl stands for split. it makes the process executing this instruction
"split", that is, creates another process at the position pointed to
by its first operand. execution order is such that the original process
executes first. (that is, the instruction directly after the spl)

so basically:

spl 2
dat 0
jmp -2

will create another process executing the
instruction 2 places away from the spl. the original process
will get to execute the dat before the newly spawned one jumps
back to the spl. (too lazy to draw the process queue) 😛

> whats a djn stream? I will also try to look this up

djn.f foo, <-bar
would be a djn stream.
djn stands for "decrement jump not zero"
which basically means that it is going to decrement the a-(.a) and(.f)
/or(.b) the b-field of the location pointed to by its own b-field.
a decrement stream is created by using an inc/decrement indirect
addressing mode:

"{" <- a-field post-decrement indirect (don't get me
wrong.. the indirection takes place after the location being decremented)
"}" <- a-field pre-increment indirect
"<" <- for b-field
">" <- guess

so each time the djn is executed, its b-field will decrement the b-field
at -bar and use it as a pointer to the fields going to be decremented by
the djn. (.f will decrement both fields, .a ... .b .. guess).
if both fields (in case of .f), .a or .b are zero after having been
decremented, djn will not jump. therefore it is a bit more secure to use
..f (a- and b-field of the decremented position have to be 0) apart from
having more destructive potential.

> what is an optimal step size? 3 or 4? (just guessing)

hmm mr karonen has already given you a few hints ^^. (3 or 4 would
nonetheless be an improvement against most warriors..)
good stepsizes find opponents faster, but depend on your warrior too..

> what is the add.f and djn.f?

"add.f" <- add the a- and b-field of the instruction pointed to by its
a-field to the a- and b-field of the instruction pointed to by its
b-field.

"djn.f" <- explained above.

*breathes*
have fun,
Andreas Scholta
 
Archived from groups: rec.games.corewar (More info?)

Chris Lukas wrote:

> whats an spl? i will look it up, but the beginner's guide doesn't
> explain most things well enough for me to understand. (i don't blame
> the author... im 13)

SPL creates a new process at the given adress. The new process will be
scheduled after it's father process.

>
> whats a djn stream? I will also try to look this up

DJN - Stream is a little Trick to color the Core or Damage your Enemys.

For Example..If you have a line like

jmp loop

in your Source, with free b-field, you can swap the jmp with djn and set the
b-field somewhere before your Warrior.

loop mov.i bomb,@bomb
add.ab #4,bomb
djn.f loop, <loop-3
bomb dat.f 0,0

So on every jmp to loop, the pointer by loop-3 will be decremented and the
instruction it pointed will be decrement too. But be careful.

1. Decrement-stream can bve stopped by 1 in a and/or b-field, and then the
execution falls through.

2. DJN, doesn't stop, so you must make your Warrior decrement resistent.

>
> what is an optimal step size? 3 or 4? (just guessing)
>

The optimal stepsize provides the best deviation of bombs in the core. For
simple bomber or stones it can be found by corestep from Jay Han oder mOpt
by Stefan Strack. For today's complex Stone you can only find optimal
coinstants with optimizing tools.

> what is the add.f and djn.f?

add.f...add the a and the b field of the a-instruction to th a and the
b-field of the b instruction. Store result in th b -instruction.

start add.f a_inst, b_inst
a_inst dat.f 25, 30
b_inst dat.f 7, 14

after execution the b_inst looks like

b_inst dat.f 32, 44

o.k

djn.f decrement b-target and jump if a and b field are not zero.


--
Parlez vous Redcode?