zlib_entropy_v5

AuthorLogicAI
Submission date2018-08-21 15:58:39.560957
Rating6421
Matches played275
Win rate61.45

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

Source code:

import zlib
import random

winning = {"R": "P", "P": "S", "S": "R"}

if not input:
    output = random.choice(["R","P","S"])
    dna = ""
else:
    dna += input
    options = []
    n = len(dna)
    for move in ["R", "P", "S"]:
        options.append((
            round(len(zlib.compress(dna + move, 9))/5),
        random.random(), move))
    best_opp = min(options)[2]
    output = winning[best_opp]