;redcode-94 ;name Cheater 2.0 ;author Nathan Green ;strategy Use knowledge of the -F number to my advantage ;assert CORESIZE==8000 ; Use "pmars -F 1234" RESULT equ #0 ROUND equ #1 NUM equ #2 DEFEND equ #3 OFFSET equ #4 ptr dat.f 20,1234 ; B-field is the -F number round ldp.ab NUM,#0 ; Load attack address from p-space add.b round,ptr ; Offset by magic number (round 1 = 0+magic) loop mov.i bomb,>ptr ; Hit 'em mov.i bomb,>ptr djn.b loop,#10 x ldp.ab ROUND,#0 ; Increment round counter. add.ab #1,x mov.b x,bomb stp.b x,ROUND sub.ba ptr,ptr ; Check if opponent is at negative position seq.i *ptr,ptr-1 stp.ab #1,DEFEND ; If so, plan on reversing attacks in future div.ab #2,bomb ; Calculate array position for next number mod.ab #2,x add.ab #1,bomb seq.b x,#0 ; Retrieve address. mov.ba @bomb,@bomb mov.ab @bomb,ptr y ldp.ab DEFEND,#0 ; Reverse if we are defending jmz.b z,y sub.ba ptr,bomb mov.ab bomb,ptr z ldp.ab OFFSET,#0 ; If we lost, increment offset res ldp.ab RESULT,#1 sne.ab #0,res add.ab #2,z add.b z,ptr ; add the offset to the address stp.b z,OFFSET done stp.b ptr,NUM ; Store next attack address in p-space clear mov bomb,@last ; Clean up anything that may have booted. djn.b clear,last clear2 mov bomb2,*last djn.a clear2,last jmp #0,