rps_pavankasireddi_start

Authorpavankasireddi
Submission date2019-06-09 04:22:01.448270
Rating1356
Matches played208
Win rate12.98

Use rpsrunner.py to play unranked matches on your computer.

Source code:

import random

if not input:
    total_len = 5
    beatthepairs = {'R':'P', 'P':'S', 'S':'R'}
    total = [''] * total_len
    output = random.choice("RPS")
else:
    total = total[1:] + [input]
    Rock_num = (total.count('R'), 'R')
    Paper_num = (total.count('P'), 'P')
    Scissors_num = (total.count('S'), 'S')
    min_value = min(Rock_num, Paper_num, Scissors_num)[0]
    min_index = [x[1] for x in [Rock_num, Paper_num, Scissors_num] if x[0] == min_value]
    output = beatthepairs[random.choice(min_index)]