Thursday, 12 June 2008

Tales from the Digital Wilderness


Tales from the Digital Wilderness is John Metcalf's Redcode programming blog, hosted at http://impomatic.blogspot.com.  Emphasis is given to implementing real algorithms in Redcode such as sorting and seaching.

John uses a standard Blogger template, with a post archive and a selection of useful Corewar links in the sidebar.  Usually there are 3 to 4 posts per month.

There are two Corewar related posts.  Parallel Processes describes a useful pMARS macro and An Improved '88 Quick-scanner shows how Paul Kline's technique can be used to create a 48 instruction '88 qscan which scans 36 locations.  The remainder of the blog is devoted to algorithms.

Some posts I found particularly interesting are Comb sortStooge sort and Gnome sort which I hadn't previously heard of.  Apart from sorting, there are implementations of seaching and number theory algorithms.  A post comparing the performance of the different techniques would be an interesting addition.

What I liked:
  • A unique concept
  • The code is well written
Room for improvement:
  • For the more complex code, a detailed description would be nice
  • A few comments would make the code easier to understand

Sunday, 8 June 2008

Philip Thorne's Corewar Introduction



Philip Thorne's Corewar Introduction can be found at http://home.pipeline.com/~corewar and has been reporting the latest tournament news since 2002.  The homepage has a handy selection of links for Corewar beginners.

What really make's Phil's site stand out is the unique content.  There are two useful tools, RSS feeds for the KOTH hills and a Redcode syntax definition for VIM.  The RSS feeds are updated daily.

Phil's Stone Analysis article has a thorough examination of 13 stones, comparing everything from speed and coverage to the type of core-clear.  Unfortunately, I didn't understand all of the figures in the table - a key would be helpful.

Finally, Phil has published a selection of warriors.  The layout here is almost perfect!  The warriors are presented in an interactive tree structure and the warrior files are displayed with syntax highlighting.

What I liked:
  • The Stone Analysis article
  • The presentation of warriors
Room for improvement:
  • A key to help interpret the Stone Analysis table

Wednesday, 4 June 2008

Neo's World of Corewar

Germán Labarga completely overhauled his website a few months back with a new URL, new design and updated content. The new location is http://labarga.atspace.com. The new layout is clutter free and easy to navigate.

Neo used to pose a programming challenge in Redcode every couple of weeks, and the results from the Mini Challenges are hosted here. There's also a selection of Neo's published warriors. This section could be improved a little by including some short comments.

The highlight of the site has to be the article documenting P-Key's Development. P-Key is an adaptive switcher which won the Smart Switching tournament round.

What I liked:
  • The results from the Mini Challenges
  • The article about P-Key
Room for improvement:
  • Some brief comments on the warriors page would be nice
  • The tools page needs more links (it currently has only one)

Tuesday, 11 September 2007

ripples in space-time

While looking through the breakdown of nano warriors by strategy I
noticed the absence of a decent 4 line paper, despite the success of
5-liners like Fluffy's Black Sun III. I quickly hacked something up
and added a quick-bomb to the beginning.


I tested with some hand-picked constants against Metcalf's nano
benchmark. It scored 139.2, or 129.8 with the quick-bomb removed.



;redcode-nano
;name hand coded paper
;author S.Fernandes
;strategy paper
;assert CORESIZE == 80

pstep equ 15
ipos equ 40
cpos equ -5
dpos equ 35

mov >60 , 10
paper spl #0 , <pstep
mov }paper , >paper
mov >ipos , <cpos
djn.f *pstep-2 , <dpos
end

Optimization


In the first round of optimization 400 warriors are generated with
all constants randomized. A small script is run over the source
below replacing each exclamation mark with a random number. The
quick-bomb will be disabled until the final stage.



org paper

pstep equ (4+!%73) ; range 4-76
ipos equ (2+!%70) ; range 2-71
cpos equ (8+!%70) ; range 8-77
dpos equ (7+!%70) ; range 7-76

mov >27 , 54
paper spl #0 , <pstep
mov }paper , >paper
mov >ipos , <cpos
djn.f *pstep-2 , <dpos
end

I've use modulo to restrict the range of random values to prevent
self-bombing. This reduces the search space by approximately 40%.
While this may stop some interesting self-mutation or interaction
being found, it's really the author's job not the optimizer's to
discover these.


The peak score is 139.5. Now we take a closer look at the top 10
results to compare the paper step. -17 occurs four times, -18 twice
and -15, -22, -25 and 33 once.


For stage 2 we generate 100 warriors for each of the above paper
steps with all other constants randomized. The peak score is 145.8
with pstep -22 followed by 145.0 with pstep -17.


The top two warriors from stage 2 are taken and their cpos
optimized in stage 3. All 70 values are tested for each warrior.
The peak score for the warrior with pstep -22 remains at
145.8. The score for the warrior with pstep -17 improves
to 145.7.


In stage 4 we take the top warrior for each pstep from
stage 3 and optimize dpos. The scores increase to 146.2
(pstep -22) and 145.8 (pstep -17).


In stage 5 we optimize ipos. The scores go up to 146.8
(pstep -22) and 149.2 (pstep -17).


Finally the quick-bomb is enabled and its two constants optimized.
400 random pair of quick-bomb constants are generated. The final
benchmark scores are 158.3 (pstep -22) and 159.2
(pstep -17).


Submission to SAL's Nano Hill


Although the benchmark scores are impressive, the hill contains 50
completely different warriors. If the benchmark reflects the hill
well, the scores should be within 10%.


The paper with pstep -22 scores 146.2 and takes 6th
place. With pstep -17 however the score is 152.3 and 4th
place.



;redcode-nano
;name ripples in space-time
;author S.Fernandes
;strategy paper
;assert CORESIZE == 80

pstep equ -17
ipos equ 10
cpos equ -33
dpos equ 36

mov >-39 , 25
paper spl #0 , <pstep
mov }paper , >paper
mov >ipos , <cpos
djn.f *pstep-2 , <dpos
end


;redcode-nano
;name ripples 22
;author S.Fernandes
;strategy paper
;assert CORESIZE == 80

pstep equ -22
ipos equ -34
cpos equ 17
dpos equ -29

mov >-38 , 25
paper spl #0 , <pstep
mov }paper , >paper
mov >ipos , <cpos
djn.f *pstep-2 , <dpos
end