From news-rocq.inria.fr!univ-lyon1.fr!jussieu.fr!oleane!tank.news.pipex.net!pipex!soap.news.pipex.net!pipex!dish.news.pipex.net!pipex!lade.news.pipex.net!pipex!news00.sunet.se!sunic!news99.sunet.se!news.luth.se!eru.mt.luth.se!bloom-beacon.mit.edu!newsfe Mon Nov 6 15:10:50 1995 Article: 2791 of rec.games.corewar Path: news-rocq.inria.fr!univ-lyon1.fr!jussieu.fr!oleane!tank.news.pipex.net!pipex!soap.news.pipex.net!pipex!dish.news.pipex.net!pipex!lade.news.pipex.net!pipex!news00.sunet.se!sunic!news99.sunet.se!news.luth.se!eru.mt.luth.se!bloom-beacon.mit.edu!newsfeed.internetmci.com!chi-news.cic.net!uwm.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!lerc.nasa.gov!purdue!mozo.cc.purdue.edu!cartoon.ecn.purdue.edu!bremermr From: bremermr@cartoon.ecn.purdue.edu (Myer R. Bremer) Newsgroups: rec.games.corewar Subject: my sorter Date: 4 Nov 1995 02:07:26 GMT Organization: Purdue University, W. Lafayette, IN Lines: 82 Message-ID: <47ehsu$jtf@mozo.cc.purdue.edu> NNTP-Posting-Host: cartoon.ecn.purdue.edu Greetings. Well. I have something that works ( possibly most of the time, hopefully enough for the tournament data sets ). I'm not big on testing, so I'm not sure if it can hand all the degenerative cases. I think so. I never understood how to quicksort so I did a bubble. Tried to get it as small as possible obviously, since it's SLOOOOOW. The sort routine is 26 lines long, the rest of the 51 lines compromise the deletion routine. I know that Bezzi did a bubble--please, please be bigger. For your derision: ;contact ;nsfcwt round 4 ;redcode-94 ;name bubble gum ;author M R Bremer ;strategy pray for ordered data. ;strategy hopefully small, hopefully not TOO slow. ;strategy my quicksort-->bubble speedup is in the shop. ;strategy please, please, please, please don't break my sorter org start PTRSAVE EQU -1 ENDER EQU -2 ADDER EQU -3 STORAGE EQU -4 ptr dat 4001-1, 4002-1 start jmz.b stock, ptr+4000 ;stock is ascending order modify mov.x ptr, ptr ;change to descending order stock seq.i >count, ENDER+ptr ;parse: how many elements to sort djn.f -1, ADDER+ptr sub.f ADDER+ptr, ptr ;points ptr to (quasi)bottom of list mov ptr, PTRSAVE+ptr mul.a #-1, ADDER+ptr add.ab ADDER+ptr, j3 add.ab ADDER+ptr, j2 pass add.ab ADDER+ptr, j sortb slt.b {ptr, flag ;there were switches this pass erase sne.i @sortb, ENDER+ptr jmp j2 sne.ab #3990, pass ;don't kill flag jmp dec sne.i @pass, @sortb mov.i ENDER+ptr, @pass ;wipe the double out! dec nop pass nop }pass j3 djn.b degap, #0 mov.i ENDER+ptr, >pass ;mark the end