;redcode-94 ;name Altruist 2/3 ;author Robert Macrae ;strategy Simple switcher based on last result: ;strategy Win -> Stone, Lose -> Paper, Draw -> Usually Paper. ;assert VERSION >= 80 ; Will accept a Win/Loss series, which is fair, and is prepared to die to ; maintain harmony. This helps the other more than myself, but results in ; 150-150 scores in "fights" with other altruists. ; -------------------------------------------------------------------------- ; Variables ; _Count is tested to see whether I should try Stone after a run of Papers. ; Play a stone after FIRST draws, and again after every EVERY draws. ; Brainwashing will cause resets to counter, so I cover both STPs when ; I play paper. If FIRST is more than 10 or so BW may still have an effect. FIRST EQU 2 EVERY EQU 3 _Res EQU #0 _Count EQU #1 ; -------------------------------------------------------------------------- Coerce LDP.a _Res, JumpVec ; Get last result SNE.a #1, JumpVec STP #0, _Count ; Reset count on a win MOV.i #0, -1 JMP JumpVec ; and execute selected warrior ; -------------------------------------------------------------------------- Count LDP.a _Count, Stoc ; How many draws without a win? ADD.a #1, Stoc Stoc STP #0, _Count MOD.a #EVERY, Stoc ; Play a stone after FIRST, then SNE.a #FIRST, Stoc ; again after every EVERY. JMP StoAdd JMP PapAdd ; Otherwise, paper. ; -------------------------------------------------------------------------- ; Jump Vectors ; Converts -1,0,1,2 result code into an address for execution. DAT 0, StoAdd JumpVec JMP @0, PapAdd DJN.a #100, #0 ; It is polite to permit slower P-brains DAT 0, Count ; to complete their analysis :-) ; --------------------------------------------------------------- ; Paper TSTEP equ 1800 CSTEP equ 3740 NSTEP equ -1922 FSTEP equ 1870 PapAdd mov.i #0, Stoc ; Reduce BW if play paper split spl 1, <-200 spl 1, <-300 mov.i -1, 0 tim1 spl @tim1, }TSTEP mov.i }tim1, >tim1 cel1 spl @cel1, }CSTEP mov.i }cel1, >cel1 ; Stun here with L4 carpet mov.i {-FSTEP, NSTEP dat 0, 0 dat 0, 0 dat 0, 0 dat 0, 0 ; --------------------------------------------------------------- ; Stone StoAdd equ dbomb+1 dbomb dat >-1, >1 spl #0, <-100 mov dbomb, tar-197*3500 tar add #197, -1 ; gets bombed to start coreclear djn.f -2, <-1151 END Coerce