Welcome to GameHourz.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Part II - 40 scans using only sne/seq pairs!

 
   Game Forums (Home) -> Core War RSS
Related Topics:
Extended qscan using only sne/seq pairs. Part I - A general form of q4ish scan can be like this: tA dat 0 ,qA tB dat 0 ,qB tC dat 0 ,qC sne seq <tA jmp decode ..

CoreWar Comic Book Part 9 - This is a message in MIME format. 8bit inline Hi! I've made new CW comic. Text file is in the Enjoy! Lukasz..

Score Surface for 94nop - Hi, some anonymous person (still called for ;-) is so kind to provide access to a pile of I have suggested to calculate one score surface for standard settings. It takes roughly 1000 times the time of one surface to..

Bug in pMARS - Hi, either I don't know how EQUs work or I have found a bug in the parser of pMARS. So far I cound pin it down to: ;name test ;assert CORESIZE == 800 v3 EQU 3 * (3 / 2 + 1) + 3 v4 EQU (CORESIZE - v3) dat.f v3, v4 With the..

KOTH.ORG: Status - ICWS Experimental 94 03/06/06 - Weekly Status on 03/06/06 -=- is up! Meetings held in #corewars -=- Tons of new features on pages -=- *FAQ* page located at: Current Status of the KOTH.ORG ICWS 94..
Next:  Core War: KOTH.ORG: Status - 94 No Pspace 01/28/08  
Author Message
pauldkline

External


Since: Dec 01, 2007
Posts: 19



(Msg. 1) Posted: Mon Jan 28, 2008 2:46 pm
Post subject: Part II - 40 scans using only sne/seq pairs!
Archived from groups: rec>games>corewar (more info?)

Part II - 40 scans using only sne/seq pairs!

First question - is it worth it to add more scans. Obviously you are
going to get bigger and make yourself easier to find. So are big
qscans better than small qscans?

Say you and your opponent have 8 sne/seq/jmp qscans that total 24
lines and scan 32 locations. If you add another sne/seq/jmp quad you
gain 4 more chances of finding your opponent. That is an increase of
4/32=.125, while his chance of finding you increases 3/24=.125. Looks
like a wash. Hold on though, your opponent also has a 15-line stone-
imp boot. You also increased your chance of finding that code by .125
with no increased risk to yourself. So it looks like you should use
the biggest qscan you can manage. The tradeoff will be when you are
still scanning after he has booted the stone-imp, then his qscan-and-
boot are just a huge decoy for you to waste time on.

Here is a new version of the previous general form that scans 40
locations using only sne/seq:

tA dat tE ,qA
tB dat 1 ,qB
tC dat tF ,qC
tD dat tJ ,qD

sne qPtr+qA*qM ,qPtr+qA*qM+Dist ; mutate tB
seq <tA ,qPtr+(qA-1)*qM+Dist
djn.a decode ,{tB
sne qPtr+qB*qM ,qPtr+qB*qM+Dist
seq <tB ,qPtr+(qB-1)*qM+Dist
jmp decode ,{tB
sne qPtr+qC*qM ,qPtr+qC*qM+Dist
seq <tC ,qPtr+(qC-1)*qM+Dist
tE jmp decode ,qE
sne qPtr+qD*qM ,qPtr+qD*qM+Dist
seq <tD ,qPtr+(qD-1)*qM+Dist
jmp decode ,}tB

sne qPtr+qE*qM ,qPtr+qE*qM+Dist ; mutate decode
seq <tE ,qPtr+(qE-1)*qM+Dist
jmp decode ,{decode
sne qPtr+qF*qM ,qPtr+qF*qM+Dist
seq <tF ,qPtr+(qF-1)*qM+Dist
jJ jmp decode ,}decode

sne qPtr+qG*qM ,qPtr+qG*qM+Dist ; mutate pH
seq <tG ,qPtr+(qG-1)*qM+Dist
jmp decode-1 ,{pH
sne qPtr+qH*qM ,qPtr+qH*qM+Dist
pH seq <tH ,qPtr+(qH-1)*qM+Dist
tF jmp decode-1 ,qF
sne qPtr+qI*qM ,qPtr+qI*qM+Dist
seq <tI ,qPtr+(qI-1)*qM+Dist
jmp decode-1 ,}pH

sne qPtr+qJ*qM ,qPtr+qJ*qM+Dist ; mutate decode
twice
seq <tJ ,qPtr+(qJ-1)*qM+Dist
jmp jJ ,}decode ; double-
jmp to decode
tJ jmp launch ,qJ

mov.a #pH-decode ,decode ; new decode
option
decode mul.b *tB ,qPtr
sne null ,@qPtr
add.a #Dist ,qPtr
mov bomb ,@qPtr
qPtr mov bomb ,@qM
add.ab #Incr ,qPtr
djn -3 ,#10
...
launch
tG spl 1 ,qG ; hiding qG-qI in other code
tH spl 1 ,qH
tI spl 1 ,qI
...

Even though this form requires five new lines, tA-tD and the mov
before decode, it is more dense than q4.5 scans. And there is an
advantage in that four of those lines are dat's and won't be
executed. If they get bombed it might not be fatal. In some programs
it might be possible to bury them out of sight. Also, there is no
special restriction on Dist so we can reject scan-pairs that are < 100
apart.

The same math as before defines qA-qJ: qX = (tX-qPtr)*qMod + 1

Now our parameters defining qA-qJ are:
tA = location of tA (determines tB-tD
tG = location of tG (determines tH&tI)
tE = location of tE (determines tF&tJ)
Dist = distance between pairs of scans
qMod = some value where (qM-1)*qMod = 1 mod 8000

From the above, I constructed a program using a 14-line paper launch
with tA fixed at zero. I let Dist vary from 100 to 4000 by 20. The
code blocks imply a constraint on the distances between tA tG & tE,
but all told there are about 180,000 combinations for each qM/qMod
pair. And there are 3201 of those pairs, so that gives .... um let me
see ... 570 million combinations. Hooraw!

The next thing you will all appreciate Smile Right now the only
programming language I have access to is Redcode using CoreWin. Oh
for a c compiler.. My challenge is to generate 570 million lists of
40 values and select only those lists whose minimum distance between
values is >= 100. But CoreWin has a 2G maxcycles limit per round. My
first version was able to process one qM/qMod pair in about 5
minutes. Times 3200 that is 16000 minutes, which is, like, weeks!
After a few more rewrites I can now process the entire set of 540
million lists in about 10 hours, using p-space to store the working
parameters between rounds.

When finished, I have a list of about 300 qM's in p-space that I can
reprocess one at a time to see the actual parameters. Or I can
introduce more constraints and rerun just these qM's.

This may be the first useful application of Redcode ever Smile

The next challenge would be to reduce tA-tD. I leave that as an
exercise for the reader Smile

P. Kline

 >> Stay informed about: Part II - 40 scans using only sne/seq pairs! 
Back to top
Login to vote
digital.wilderness

External


Since: Mar 04, 2006
Posts: 6



(Msg. 2) Posted: Mon Jan 28, 2008 8:22 pm
Post subject: Re: Part II - 40 scans using only sne/seq pairs! [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 28, 10:46 pm, pauldkl... DeleteThis @aol.com wrote:
> Part II - 40 scans using only sne/seq pairs!
>
> First question - is it worth it to add more scans.  Obviously you are
> going to get bigger and make yourself easier to find.  So are big
> qscans better than small qscans?
>
> Say you and your opponent have 8 sne/seq/jmp qscans that total 24
> lines and scan 32 locations.  If you add another sne/seq/jmp quad you
> gain 4 more chances of finding your opponent.  That is an increase of
> 4/32=.125, while his chance of finding you increases 3/24=.125.  Looks
> like a wash.  Hold on though, your opponent also has a 15-line stone-
> imp boot.  You also increased your chance of finding that code by .125
> with no increased risk to yourself.  So it looks like you should use
> the biggest qscan you can manage.  The tradeoff will be when you are
> still scanning after he has booted the stone-imp, then his qscan-and-
> boot are just a huge decoy for you to waste time on.
>
> Here is a new version of the previous general form that scans 40
> locations using only sne/seq:
>
> tA       dat     tE           ,qA
> tB       dat     1            ,qB
> tC       dat     tF           ,qC
> tD       dat     tJ           ,qD
>
>          sne     qPtr+qA*qM   ,qPtr+qA*qM+Dist      ; mutate tB
>          seq     <tA          ,qPtr+(qA-1)*qM+Dist
>          djn.a   decode       ,{tB
>          sne     qPtr+qB*qM   ,qPtr+qB*qM+Dist
>          seq     <tB          ,qPtr+(qB-1)*qM+Dist
>          jmp     decode       ,{tB
>          sne     qPtr+qC*qM   ,qPtr+qC*qM+Dist
>          seq     <tC          ,qPtr+(qC-1)*qM+Dist
> tE       jmp     decode       ,qE
>          sne     qPtr+qD*qM   ,qPtr+qD*qM+Dist
>          seq     <tD          ,qPtr+(qD-1)*qM+Dist
>          jmp     decode       ,}tB
>
>          sne     qPtr+qE*qM   ,qPtr+qE*qM+Dist      ; mutate decode
>          seq     <tE          ,qPtr+(qE-1)*qM+Dist
>          jmp     decode       ,{decode
>          sne     qPtr+qF*qM   ,qPtr+qF*qM+Dist
>          seq     <tF          ,qPtr+(qF-1)*qM+Dist
> jJ       jmp     decode       ,}decode
>
>          sne     qPtr+qG*qM   ,qPtr+qG*qM+Dist      ; mutate pH
>          seq     <tG          ,qPtr+(qG-1)*qM+Dist
>          jmp     decode-1     ,{pH
>          sne     qPtr+qH*qM   ,qPtr+qH*qM+Dist
> pH       seq     <tH          ,qPtr+(qH-1)*qM+Dist
> tF       jmp     decode-1     ,qF
>          sne     qPtr+qI*qM   ,qPtr+qI*qM+Dist
>          seq     <tI          ,qPtr+(qI-1)*qM+Dist
>          jmp     decode-1     ,}pH
>
>          sne     qPtr+qJ*qM   ,qPtr+qJ*qM+Dist      ; mutate decode
> twice
>          seq     <tJ          ,qPtr+(qJ-1)*qM+Dist
>          jmp     jJ           ,}decode                        ; double-
> jmp to decode
> tJ       jmp     launch       ,qJ
>
>          mov.a   #pH-decode   ,decode               ; new decode
> option
> decode   mul.b   *tB          ,qPtr
>          sne     null         ,@qPtr
>          add.a   #Dist        ,qPtr
>          mov     bomb         ,@qPtr
> qPtr     mov     bomb         ,@qM
>          add.ab  #Incr        ,qPtr
>          djn     -3           ,#10
>          ...
> launch
> tG       spl     1            ,qG   ; hiding qG-qI in other code
> tH       spl     1            ,qH
> tI       spl     1            ,qI
>          ...
>
> Even though this form requires five new lines, tA-tD and the mov
> before decode, it is more dense than q4.5 scans.  And there is an
> advantage in that four of those lines are dat's and won't be
> executed.  If they get bombed it might not be fatal.  In some programs
> it might be possible to bury them out of sight.  Also, there is no
> special restriction on Dist so we can reject scan-pairs that are < 100
> apart.
>
> The same math as before defines qA-qJ:  qX = (tX-qPtr)*qMod + 1
>
> Now our parameters defining qA-qJ are:
>  tA   = location of tA  (determines tB-tD
>  tG   = location of tG  (determines tH&tI)
>  tE   = location of tE  (determines tF&tJ)
>  Dist = distance between pairs of scans
>  qMod = some value where (qM-1)*qMod = 1 mod 8000
>
> From the above, I constructed a program using a 14-line paper launch
> with tA fixed at zero.  I let Dist vary from 100 to 4000 by 20.  The
> code blocks imply a constraint on the distances between tA tG & tE,
> but all told there are about 180,000 combinations for each qM/qMod
> pair.  And there are 3201 of those pairs, so that gives .... um let me
> see ... 570 million combinations.  Hooraw!
>
> The next thing you will all appreciate Smile  Right now the only
> programming language I have access to is Redcode using CoreWin.  Oh
> for a c compiler..  My challenge is to generate 570 million lists of
> 40 values and select only those lists whose minimum distance between
> values is >= 100.  But CoreWin has a 2G maxcycles limit per round.  My
> first version was able to process one qM/qMod pair in about 5
> minutes.  Times 3200 that is 16000 minutes, which is, like, weeks!
> After a few more rewrites I can now process the entire set of 540
> million lists in about 10 hours, using p-space to store the working
> parameters between rounds.
>
> When finished, I have a list of about 300 qM's in p-space that I can
> reprocess one at a time to see the actual parameters.  Or I can
> introduce more constraints and rerun just these qM's.
>
> This may be the first useful application of Redcode ever Smile
>
> The next challenge would be to reduce tA-tD.  I leave that as an
> exercise for the reader Smile
>
> P. Kline

Hi Paul,

I'd be interested to see you Redcode application. I have something
here - http://corewar.co.uk/temp/xycalc.red, but I think the award for
most useful app in Redcode goes to Joonas's Optima finder -
http://www.ociw.edu/~birk/COREWAR/ODD/HILL/optima1.red

Cheers,

John

 >> Stay informed about: Part II - 40 scans using only sne/seq pairs! 
Back to top
Login to vote
sayembara

External


Since: Dec 22, 2005
Posts: 38



(Msg. 3) Posted: Tue Jan 29, 2008 4:34 am
Post subject: Re: Part II - 40 scans using only sne/seq pairs! [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 29, 6:46 am, pauldkl....TakeThisOut@aol.com wrote:
> Part II - 40 scans using only sne/seq pairs!
>
> First question - is it worth it to add more scans. Obviously you are
> going to get bigger and make yourself easier to find. So are big
> qscans better than small qscans?
>
> Say you and your opponent have 8 sne/seq/jmp qscans that total 24
> lines and scan 32 locations. If you add another sne/seq/jmp quad you
> gain 4 more chances of finding your opponent. That is an increase of
> 4/32=.125, while his chance of finding you increases 3/24=.125. Looks
> like a wash. Hold on though, your opponent also has a 15-line stone-
> imp boot. You also increased your chance of finding that code by .125
> with no increased risk to yourself. So it looks like you should use
> the biggest qscan you can manage. The tradeoff will be when you are
> still scanning after he has booted the stone-imp, then his qscan-and-
> boot are just a huge decoy for you to waste time on.
>
> Here is a new version of the previous general form that scans 40
> locations using only sne/seq:
>
> tA dat tE ,qA
> tB dat 1 ,qB
> tC dat tF ,qC
> tD dat tJ ,qD
>
> sne qPtr+qA*qM ,qPtr+qA*qM+Dist ; mutate tB
> seq <tA ,qPtr+(qA-1)*qM+Dist
> djn.a decode ,{tB
> sne qPtr+qB*qM ,qPtr+qB*qM+Dist
> seq <tB ,qPtr+(qB-1)*qM+Dist
> jmp decode ,{tB
> sne qPtr+qC*qM ,qPtr+qC*qM+Dist
> seq <tC ,qPtr+(qC-1)*qM+Dist
> tE jmp decode ,qE
> sne qPtr+qD*qM ,qPtr+qD*qM+Dist
> seq <tD ,qPtr+(qD-1)*qM+Dist
> jmp decode ,}tB
>
> sne qPtr+qE*qM ,qPtr+qE*qM+Dist ; mutate decode
> seq <tE ,qPtr+(qE-1)*qM+Dist
> jmp decode ,{decode
> sne qPtr+qF*qM ,qPtr+qF*qM+Dist
> seq <tF ,qPtr+(qF-1)*qM+Dist
> jJ jmp decode ,}decode
>
> sne qPtr+qG*qM ,qPtr+qG*qM+Dist ; mutate pH
> seq <tG ,qPtr+(qG-1)*qM+Dist
> jmp decode-1 ,{pH
> sne qPtr+qH*qM ,qPtr+qH*qM+Dist
> pH seq <tH ,qPtr+(qH-1)*qM+Dist
> tF jmp decode-1 ,qF
> sne qPtr+qI*qM ,qPtr+qI*qM+Dist
> seq <tI ,qPtr+(qI-1)*qM+Dist
> jmp decode-1 ,}pH
>
> sne qPtr+qJ*qM ,qPtr+qJ*qM+Dist ; mutate decode
> twice
> seq <tJ ,qPtr+(qJ-1)*qM+Dist
> jmp jJ ,}decode ; double-
> jmp to decode
> tJ jmp launch ,qJ
>
> mov.a #pH-decode ,decode ; new decode
> option
> decode mul.b *tB ,qPtr
> sne null ,@qPtr
> add.a #Dist ,qPtr
> mov bomb ,@qPtr
> qPtr mov bomb ,@qM
> add.ab #Incr ,qPtr
> djn -3 ,#10
> ...
> launch
> tG spl 1 ,qG ; hiding qG-qI in other code
> tH spl 1 ,qH
> tI spl 1 ,qI
> ...
>
> Even though this form requires five new lines, tA-tD and the mov
> before decode, it is more dense than q4.5 scans. And there is an
> advantage in that four of those lines are dat's and won't be
> executed. If they get bombed it might not be fatal. In some programs
> it might be possible to bury them out of sight. Also, there is no
> special restriction on Dist so we can reject scan-pairs that are < 100
> apart.
>
> The same math as before defines qA-qJ: qX = (tX-qPtr)*qMod + 1
>
> Now our parameters defining qA-qJ are:
> tA = location of tA (determines tB-tD
> tG = location of tG (determines tH&tI)
> tE = location of tE (determines tF&tJ)
> Dist = distance between pairs of scans
> qMod = some value where (qM-1)*qMod = 1 mod 8000
>
> From the above, I constructed a program using a 14-line paper launch
> with tA fixed at zero. I let Dist vary from 100 to 4000 by 20. The
> code blocks imply a constraint on the distances between tA tG & tE,
> but all told there are about 180,000 combinations for each qM/qMod
> pair. And there are 3201 of those pairs, so that gives .... um let me
> see ... 570 million combinations. Hooraw!
>
> The next thing you will all appreciate Smile Right now the only
> programming language I have access to is Redcode using CoreWin. Oh
> for a c compiler.. My challenge is to generate 570 million lists of
> 40 values and select only those lists whose minimum distance between
> values is >= 100. But CoreWin has a 2G maxcycles limit per round. My
> first version was able to process one qM/qMod pair in about 5
> minutes. Times 3200 that is 16000 minutes, which is, like, weeks!
> After a few more rewrites I can now process the entire set of 540
> million lists in about 10 hours, using p-space to store the working
> parameters between rounds.
>
> When finished, I have a list of about 300 qM's in p-space that I can
> reprocess one at a time to see the actual parameters. Or I can
> introduce more constraints and rerun just these qM's.
>
> This may be the first useful application of Redcode ever Smile
>
> The next challenge would be to reduce tA-tD. I leave that as an
> exercise for the reader Smile
>
> P. Kline

Hi Paul,

Let me try to describe what you plan to do...correct me if I'm wrong:
1) assign a value to all variables (look like brute force technique)
2) simulate until the scanning is completed
3) calculate the distance between each scanned core
4) select the set of variables that gives biggest separation of
scanned location (ideal is all scanned locs >= 100)
5) repeat if necessary

If that is the case, may be I can try from GA method:
1) GA engine assigns values to variables
2) pmars interprete warrior into codes (redcode) so that hard values
can be picked up
3) send interpreted code in some sort of Simulate.exe to capture the
scanned location only
4) Simulate.exe calcs how many >= 100 separation, <= 100, average and
what ever related; and turn them into a Fitness value
5) save best fitness
6) repeat

then compare result with brute force method for consistency of best
solution.

Any comments?
Zul Nadzri
 >> Stay informed about: Part II - 40 scans using only sne/seq pairs! 
Back to top
Login to vote
pauldkline

External


Since: Dec 01, 2007
Posts: 19



(Msg. 4) Posted: Tue Jan 29, 2008 7:04 am
Post subject: Re: Part II - 40 scans using only sne/seq pairs! [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Well, it is not that hard.

- read qm/qMod pair from table
- initialize parameters
Loop:
- save current qm/qMod & parameters in p-spce
- generate list
- test list for separations < 100
- test list for other qualities
- increment parameters or read next qm/qMod pair

What makes this work in hours instead of weeks is to use a hash to
test separations. Divide each value by 100, use the result to set a
flag. If the flag is already set, skip the list.
- set 80 flags to 1
Test:
- mov .b value,hash
- div.ab #100,hash
- add.ab #1,hash
- djn.b NewParms ,@hash

This is not a perfect test, but lightning fast and eliminates well
over 90% of the lists. I unrolled it into the generate code, so as
each value is created it is tested. That way you do not have to
compute all 40 numbers if there is a violation.

If a list does pass the hash test, sort it and compute the differences
between pairs. It is a brute force, exhaustive algorithm and about
10% of qm/qMod pairs were found to have at least one qualifying list
that works for the test program I created.

And Joonas' optima finder is a very useful program! I forgot it was
out there.

P. Kline
 >> Stay informed about: Part II - 40 scans using only sne/seq pairs! 
Back to top
Login to vote
pauldkline

External


Since: Dec 01, 2007
Posts: 19



(Msg. 5) Posted: Tue Jan 29, 2008 2:05 pm
Post subject: Re: Part II - 40 scans using only sne/seq pairs! [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

As it turns out there is a way to eliminate tA-tD, which looks quite
different than the qscan I presented. So forget those last few
posts Smile It's going to take another week to get the numbers.

P. Kline
 >> Stay informed about: Part II - 40 scans using only sne/seq pairs! 
Back to top
Login to vote
Display posts from previous:   
   Game Forums (Home) -> Core War All times are: Ekaterinburg, Islamabad, Karachi, Tashkent (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]