From news-rocq.inria.fr!jussieu.fr!oleane!tank.news.pipex.net!pipex!howland.reston.ans.net!newsfeed.internetmci.com!news.sesqui.net!rice!great-horned.owlnet.rice.edu!kfranke Fri Mar 22 14:15:16 1996 Article: 4493 of rec.games.corewar Path: news-rocq.inria.fr!jussieu.fr!oleane!tank.news.pipex.net!pipex!howland.reston.ans.net!newsfeed.internetmci.com!news.sesqui.net!rice!great-horned.owlnet.rice.edu!kfranke From: kfranke@rice.edu (Kurt Alan Franke) Newsgroups: rec.games.corewar Subject: System Trap Date: 22 Mar 1996 03:48:00 GMT Organization: Rice University, Houston, Texas Lines: 219 Message-ID: <4it7tg$4sr@larry.rice.edu> NNTP-Posting-Host: great-horned.owlnet.rice.edu X-Newsreader: TIN [version 1.2 PL2] Here is my program System Trap that won John K Lewis' tourney. The idea is to find the redOS program very quickly using the size of the OS as the scanning step, vamp it, and boot a core clear away to wipe out the opponent. If the scanner finds something that isn't the redOS (if it is too long, for example), I just drop a single dat and go on. The vamping code is interesting. Once I throw the jmp instruction onto redOS' wait statement, I jump to my backup strategy. If that really was redOS, it should have had a single process on the wait, so the next thing that happens is redOS executes the code I told it to jump to and vamps my process back from my backup strategy. It only works if there was a single process on the wait. Otherwise I go ahead and start the paper. After the mutual vamping, a core clear is booted away with both processes in it. (the core clear makes pretty patterns on the xpmars display with the different colored processes executing in it, by the way). The big weakness of this large program is qscanners. A qscan->wait will beat System Trap about 75% of the time. Glad no one decided to submit that. And of course the handshake code is about the same as what I wrote for core warrior, but it is confused with indirect pointers to p-space values. This is a hang-over from my earlier handshake which, like Mason, could be fooled. The first-round code uses a three line 1/3c scan. I can't just search for a non-zero value like Socrates because I might find the redOS. I found it interesting that I could actually beat some classic warriors, like Rave or Aeka, when I ran against them with the OS also. I didn't test against the newer warriors. Kurt -------------------------- ;redcode-94 ;assert CORESIZE == 8000 ;author Kurt Franke ;name System Trap ;strategy for JK Lewis' "Intelligent Warrior Tournament" ;strategy handshake for self-wins, and then: ;strategy 6/7 c scan looking for redOS ;strategy vamp redOS process to help with 1.5 c coreclear ;strategy or go to silk paper as a backup ;; - - - - - - - - - handshake constants - - - - - - - - - - - - - - - PIN 191 MAGICP equ 378 WINP equ 379 LOSEP equ 380 WARRIOR equ decoy ;; if handshake requires many cycles QWARRIOR equ decoy ;; if we have more time ;; - - - - - - - - - handshake initialize - - - - - - - - - - - - - - magic ldp.ab >mptr, #0 jmn QWARRIOR, $magic ;; if flag is set, fight last ldp #0, #0 sne #-1, $last ;; if it is the first round, set mptr jmp search, #magicp ;; special routine for first round ;; - - - - - - - try handshake - - - - - - - - - - - - - - - - - - - - - shake jmz lost, $last ;; the actual handshake won stp #0, #LOSEP ;; reset the expected flag stp #1, #WINP loser ldp #LOSEP, #0 ;; and then check it jmz >foe, $loser wptr jmp #WARRIOR ;; wait for end of round and win again lost stp #0, #WINP ;; reset the expected flag stp #1, #LOSEP winner ldp #WINP, #0 ;; and then check it jmz >foe, $winner magicp dat #MAGICP, #0 ;; lose again ;; - - - - - - - - - - - flag enemy warrior - - - - - - - - - - - - - - - foe stp.a #1, @0 magicp2 jmp *wptr, *magicp ;; also the key (see below) ;; - - - - - - - - - special first round routine - - - - - - - - - - - - - ;; Determine who moved first without pspace ;; 1st version waits till timeout and second kills itself key equ (count-1) count nop #key+3, }count ;; scan our own key last search seq.i $key, }count ;; 33% mod 3 scanning for other key jmp count, }count sne.i $count, }count ;; not equal for second warrior wait jmp wait, }count ;; wait if we are #1 mov 0, $key ;; erase key and quit if we are #2 ;; - - - - - - - - - - - scanner step - - - - - - - - - - - - - - - - - - WIDTH equ 35 STEP equ (2*WIDTH) incr dat {STEP, one two spl @two, }BSTEP twoa mov }two, >two threea mov {two, CSTEP ;; - - - - - - - - - - make decoy - - - - - - - - - - - - - - - - - - DECOY equ (sbomb-200) decoy ;; make a decoy -- 100 places in front should deter qscanners ;; using code from the FAQ (Neat - I didn't realize I could do ;; this at 3c) qbomb for 17 mov.i ptr ;; should be 1.5c with redOS mov $sbomb, >ptr mov $sbomb, >ptr djn.a clear, $sbomb mov $dbomb, $sbomb dbomb dat #0, #dbomb+1-ptr ;; - - - - - - - - - - fast scan for redOS with verify - - - - - - - - - FIRST equ (magic+200) ACTION equ boot BACKUP equ paper BOOT equ -2793 EMPTY equ (magic+110) match1 mov.i $6, $-30 ;; a couple lines to check OS match2 stp.b $-2, #1 reset mov.i EMPTY, @scan1 mov.ba $scan1, $scan1 sub.a #35, $scan1 next1 add.f $incr, $scan1 ;; am I overdoing this? :-) scan1 sne.i $FIRST, $FIRST+WIDTH next2 add.f $incr, $scan1 scan2 sne.i *scan1, @scan1 next3 add.f $incr, $scan1 scan3 sne.i *scan1, @scan1 timer djn $next1, #36 jmz.b BACKUP, $timer ;; couldn't find redOS sne.i EMPTY, @scan1 mov.x $scan1, $scan1 mov $scan1, $scan1+40 jmn.f reset, @scan1+40 ;; too big --> it's a decoy jmn.f 0, >scan1 ;; find the end sub #7, $scan1 ;; verify redOS sne.i @scan1, $match1 sub #11, $scan1 seq.i @scan1, $match2 jmp reset sub #12, $scan1 ;; put a jmp onto redOS's wait sub.ba $scan1, $vamp mov $vamp, @scan1 ;; hope redOS is waiting jmp BACKUP ;; back up strategy vamp jmp slave-scan1 ;; vamp for redOS recall jmp ACTION-BACKUP ;; vamp for me slave mov $recall, $BACKUP ;; stop paper strategy boot mov.i $dbomb, $BOOT ;; boot coreclear for 3 mov.i {boot,