Looking for ideas/optimizations/help on a warrior - THANKS ;)

73 views
Skip to first unread message

Francisco Jose Castillo Mogollon

unread,
Jan 28, 2023, 2:51:44 PMJan 28
to
Hello everyone!
I am a fan of Redcode and passionate about this art. Last year I participated in a local corewars tournament and this year I wanted to optimize the warrior I participated with. It is a version of Recon with bootstrap and decoy. I pass you the code. I appreciate any help, tips or ideas!!

<+++++++++++++++++++++++++++++++++++++>
;redcode-94
;assert 1
;name CHaiNS_oF_PaiN
;kill CHaiNS_oF_PaiN
;author Patxy
;strategy Recon clone with bootstrap & decoy

Timer equ 400 ; cuanta atrás para el borrado 400*4 posiciones = 1600+1100 >32%
; Compara posiciones en una horquilla de 6 celdas
; Cuando se encuentre algo, lo limpia con un manto de 14 SPLs,
; con este formato: ..X.....X.....
; Una vez consumido el Timer y cubierto la memoria con una malla de ataques,
; comenzará con un borrado de memoria.

rStep equ 6557
; caza secuencias de pasos de 3, 7, 9, and 11 saltos
; 6557 * 231 = 2667 (2667 * 3 = 1)
; 6557 * 99 = 1143 (1143 * 7 = 1)
; 6557 * 77 = 889 ( 889 * 9 = 1)
; 6557 * 63 = 5091 (5091 * 11 = 1)

; Copiamos el guerrero a otra posición de la memoria, a 2/3 de la memoria
rPlaceA equ 5334;
reconA mov rEnd, <rDest ;salto a location A
mov {reconA, <rDest
mov {reconA, <rDest
mov {reconA, <rDest
mov {reconA, <rDest
rSrc jmn reconA, {reconA
rDest spl rPlaceA+5, rPlaceA+15
for 5
dat 0, 0
rof

;warrior: SNE scanner con SPL wiper
rPtr equ (rScan-8)
dat 0, 0
dat 19, 19
rDiff spl #-rStep, #-rStep
rWipe mov rDiff, >rPtr ; golpea con una capa de SPLs
rW2 mov *rWipe, >rPtr ; más tarde >> borrado de la memoria
djn.a rWipe, rLength
rLoop sub rDiff, @rS2
rScan sne (rStep-1), (rStep-7) ; compara 2 posiciones
sub rDiff, rScan
rS2 seq *rScan, @rScan ; compara otras 2 posiciones
slt.a #20, rScan ; evita sus posiciones del scanner
rTimer djn rLoop, #Timer ; cuenta-atrás para el borrado de la memoria
rLength sub.ba #0, #-7 ; inicializa la capa de SPLs
rTweak mov.ab @rS2, @rWipe
rT2 jmn *rW2, rTimer ; cuando el contador expire,
rEnd djn.a <rTweak, {rT2 ; comenzamos el borrado de la memoria

for 5
dat 0, 0
rof

;decoy
idx for (MAXLENGTH-CURLINE)
SPL.F ((1+idx%6)*23),((1+idx%6)*91) ; decodificación enorme para confundir a los scanners
rof
end reconA
<+++++++++++++++++++++++++++++++++++++>

And by the way, ask yourself, if anyone has (or knows where to get) the book "CoreWar Krieg der Kerner Handbuch fur Einsteiger" by Sascha Zapf, in English!! (or Spanish) - Someone knows?

Thank you!!


John Metcalf

unread,
Feb 1, 2023, 6:35:29 AMFeb 1
to
Hi,

On Sat, 28 Jan 2023 11:51:43 -0800, Francisco Jose Castillo Mogollon
wrote:

> Hello everyone!
> I am a fan of Redcode and passionate about this art. Last year I
> participated in a local corewars tournament and this year I wanted to
> optimize the warrior I participated with. It is a version of Recon with
> bootstrap and decoy. I pass you the code. I appreciate any help, tips or
> ideas!!

Recon is really effective, but I can see a few opportunities. If you
haven't already, it's worth setting up a benchmark to test different
versions of CHaiNS. E.g. pick ~20 warriors from the Koenigstuhl top 50
to test against.

You could try different values of rStep to change the scan pattern.
There's a tool called Randy (available at http://inversed.ru/CoreWar.htm)
which you can use to create multiple copies with different constants.
Then run them all against the benchmark. Also, try the same for Timer.

CHaiNS is detecting its own decoy, slowing it down. The scan compares
locations which are 6 cells apart, so try changing the decoy so the
contents of decoy are the same as decoy+6, decoy+1 the same as decoy+7,
decoy+x the same as decoy+x+6, etc. Then try changing the boot distance
to avoid detect the decoy for as long as possible.

> And by the way, ask yourself, if anyone has (or knows where to get) the
> book "CoreWar Krieg der Kerner Handbuch fur Einsteiger" by Sascha Zapf,
> in English!! (or Spanish) - Someone knows?

Unfortunately, the Handbook is only available in German, but there are
quite a few guides and tutorials covering similar topics in English.

Good luck with the tournament.

John

PS - have you tried submitting to the KOTH / SAL hills? CHaiNS might
score well on the No Pspace and Multiwarrior hills :-)

Francisco Jose Castillo Mogollon

unread,
Feb 1, 2023, 7:49:13 PMFeb 1
to
I thank you very much John! I'll put your recommendations into practice and I'm sure I'll get the best version of CHaiNS for the tournament. I'll tell you how it turns out! ;)

And about participating in KOTH/SAL hills, yes!!, I could also try it! ¿what steps should i follow?

John Metcalf

unread,
Feb 3, 2023, 2:02:08 PMFeb 3
to
On Wed, 01 Feb 2023 16:49:11 -0800, Francisco Jose Castillo Mogollon
wrote:

> And about participating in KOTH/SAL hills, yes!!, I could also try it!
> ¿what steps should i follow?

Hi, just send an email with the correct ;redcode declaration
(e.g. ;redcode-94nop or ;redcode-94m). Just make sure your email is set
to plain text and there aren't any non-ASCII characters. There's a list
of hills and more info in the FAQ:

John Metcalf

unread,
Feb 3, 2023, 2:05:35 PMFeb 3
to
Reply all
Reply to author
Forward
0 new messages