PRINT"Welcome to the game of rock-paper-scissors" PRINT "Each player guesses one of these three, and reveals it at the same time." PRINT "Rock blunts scissors, which cut paper, which wraps stone." PRINT "If both players choose the same, it is a draw!" PRINT "When you've had enough, choose Q." DIM rps%(2),g$(3) g$()="rock","paper","scissors" total%=0 draw%=0 pwin%=0 cwin%=0 c%=RND(3) PRINT"What is your move (press R, P, or S)?" REPEAT REPEAT q$=GET$ UNTIL INSTR("RPSrpsQq",q$)>0 g%=(INSTR("RrPpSsQq",q$)-1) DIV 2 IF g%>2 THEN PROCsummarise:END total%+=1 rps%(g%)+=1 PRINT"You chose ";g$(g%);" and I chose ";g$(c%); CASE g%-c% OF WHEN 0: PRINT ". It's a draw" draw%+=1 WHEN 1,-2: PRINT ". You win!" pwin%+=1 WHEN -1,2: PRINT ". I win!" cwin%+=1 ENDCASE c%=FNmove(rps%(),total%) UNTIL FALSE END : DEFPROCsummarise PRINT "You won ";pwin%;", and I won ";cwin%;". There were ";draw%;" draws" PRINT "Thanks for playing!" ENDPROC : DEFFNmove(p%(),t%) LOCAL r% r%=RND(total%) IF r%<=p%(0) THEN =1 IF r%<=p%(0)+p%(1) THEN =2 =0