Oct-08-2016, 10:29 PM
(Oct-08-2016, 10:13 PM)wavic Wrote: This define a set(), right? But you initiate as a dictionary. Or I am wrong?
responses = {} for me in 'RPS': for them in 'RPS': responses[me + them] = collections.Counter('RPS')
The responses variable is not a set, it is a dictionary ({} is the literal for an empty dictionary). The keys of responses are all the possible two-player plays: RR, RP, RS, PR, PP, PS, SR, SP, and SS. It tracks what the opponent did after each round, based on what was played in that round. So if the previous round was RP, and the opponent plays S, responses['RP'] gets one added to S. That means the next time the previous round was RP, Sirius will be more likely to guess that the opponent will play S, and therefore Sirius will be more likely to play R.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures