From news-rocq.inria.fr!jussieu.fr!pasteur.fr!oleane!newsxfer3.itd.umich.edu!news.maxwell.syr.edu!supernews.com!Supernews69!not-for-mail Sun Jul 13 14:45:07 1997 Article: 7701 of rec.games.corewar Path: news-rocq.inria.fr!jussieu.fr!pasteur.fr!oleane!newsxfer3.itd.umich.edu!news.maxwell.syr.edu!supernews.com!Supernews69!not-for-mail From: Brian Haskin Newsgroups: rec.games.corewar Subject: My entry for Anton's tournament Date: Sat, 12 Jul 1997 22:20:54 -0400 Organization: All USENET -- http://www.Supernews.com Lines: 63 Message-ID: <33C83B86.64D752C5@ptway.com> NNTP-Posting-Host: 1625@199.176.148.66 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.01 [en] (Win95; I) X-Priority: 3 (Normal) Sorry if you get multiple copies of this but my mail doesn't seem to be reaching stormking.com for some reason so I'm trying the news group. It also doesn't seem to be reaching Anton so you may not even have to worry about this as a competitor, not that it's much competition. Anyway here's my sorter, it does a shell sort on a list defined by ITEMLIST (the start of the list) and ITEMS (the length of the list). Hopefully I've done all the obvious optimizations, one that really helped was sorting from the end of the list to the beginning which allowed me to use djn.f to step through the list. ;redcode ;name Seaside sort ;author Brian Haskin ;strategy Walking by the sea one day ;strategy I saw a shell by the way ;strategy Then looking inside there to my suprise ;strategy It was sorting and ordering in ascending ;strategy Ok, so I write terrible poems. ;strategy Hopefully I did a little better on the program. :) ;strategy shell sort ;assert 1 tmp equ (back-10) LAST equ (ITEMLIST+ITEMS-1) SDIST equ ((ITEMS/3)+1) org comp back add.f const, comp mov.i bjmp,ljmp comp slt.b LAST-SDIST, LAST sne.b *comp,@comp ljmp djn.f comp,comp slt.a #-comp+ITEMLIST-1,comp jmp cdist slt.f hgh,comp mov.f comp,hgh mov.i *comp,tmp mov.i @comp,*comp mov.i tmp,@comp retr slt.ab #-comp+LAST-SDIST,comp jmp back snorm mov.i njmp, ljmp mov.f hgh,comp djn.f comp,comp hgh dat #-comp+LAST,#-comp+LAST cdist slt.a #1,const const dat SDIST,SDIST div.f dvc,const mov.f lstc,comp sub.a const,comp mov.a #-comp+LAST,retr sub.a const,retr mov lstc,hgh jmp comp bjmp jmp -ljmp+snorm njmp djn.f -ljmp+comp,-ljmp+comp lstc dat #-comp+LAST,#-comp+LAST dvc dat #2,#2 end