;redcode-94 ;name Paper-Scissors-Stone #10 ;author Nandor Sieben & Stefan Strack ;White warrior that plays the game of Paper-Scissors-Stone in NSFCWT round 5 ;Needs to be paired with one opponent exactly half the coresize apart (-d 4000) ;assert 1 ; WARRIORS==1 || (WARRIORS == 2 && MINDISTANCE == CORESIZE/2) ; VERSION >= 80 ; NSFCWT 5 ;my/your_hand are used to communicate between players your_hand equ (my_hand+CORESIZE/2) PAPER equ #1 ;some useful constants SCISSORS equ #2 STONE equ #3 org start my_hand dat 0,0 ; ; Variable part starts here. This is were I decide what hand to ; use next. I can use the value of the RESULTS cell (0 if lost, ; 1 if won, 2 if tied last round) and any other values I chose ; to store in pspace. The hand I decide to show is stored in the ; B-field of instruction 'my_hand'. ;---BEGIN-VARIABLE-PART----------------------------------------------------- RESULT equ #0 ;last result STRAT equ #1 start res ldp RESULT,#res strgy ldp STRAT,#strgy ;paradoxical adapter jmz store,res ;loss -> use last strategy add #1,strgy ;tie,win -> next strategy mod #3,strgy stp strgy,STRAT store add.ab #1,strgy mov.b strgy,my_hand ;---END-VARIABLE PART------------------------------------------------------- ; End of variable part. I wait for the other player to show his hand. ; I then analyze the outcome of the game. ; wait jmz.b wait,your_hand work mov.b your_hand,#work sub.b my_hand,work ;your_hand minus my_hand, loss=1,-2 add #2,work ;loss=3,0 mod #3,work ;loss=0 live jmn live,work ;die if lost, live if won or tied end