zlib_entropy_v2

This program has been disqualified.


AuthorPawel
Submission date2018-08-21 15:01:31.841840
Rating5766
Matches played2
Win rate100.0

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 = []
    for move in ["R", "P", "S"]:
        options.append((
            len(zlib.compress(dna + move))+
            len(zlib.compress(dna[-2:] + move)) +
            len(zlib.compress(dna[-4:] + move)) +
            len(zlib.compress(dna[-8:] + move)) +
            len(zlib.compress(dna[-16:] + move)) +
            len(zlib.compress(dna[-32:] + move)) +
            len(zlib.compress(dna[-64:] + move)) +
            len(zlib.compress(dna[-128:] + move)) +
            len(zlib.compress(dna[-256:] + move)) +
            len(zlib.compress(dna[-512:] + move)) +
            len(zlib.compress(dna + move)),
        move))
    best_opp = min(options)[1]
    output = winning[best_opp]