This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import product | |
possible = [''.join(secret) for secret in product('ABCDEF', repeat=4)] | |
results = [(right, wrong) for right in range(5) for wrong in range(5 - right) if not (right == 3 and wrong == 1)] | |
def score(secret, guess): | |
first = len([speg for speg, gpeg in zip(secret, guess) if speg == gpeg]) | |
return first, sum([min(secret.count(j), guess.count(j)) for j in 'ABCDEF']) - first | |
def solve(secrets, attemptfun, first=False): |