Created
May 12, 2018 04:28
-
-
Save Neverik/1c914dc7d14c1eb7c083eeaef0e4455f to your computer and use it in GitHub Desktop.
Bulls and Cows solver, https://repl.it/repls/RelievedMonstrousFiles to run.
This file contains hidden or 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
ns = [1750, 1602, 3954, 4716] | |
ans = [(1, 1), (1, 1), (1, 1), (1, 1)] | |
def bc (a, b): | |
bs = 0 | |
cs = 0 | |
for i1, i2 in zip(a, b): | |
if i1 == i2: | |
bs += 1 | |
elif i1 in b: | |
cs += 1 | |
return bs, cs | |
def inner (a): | |
for t, answer in zip(ns, ans): | |
if bc([int (i) for i in list(str(n))], [int (i) for i in list(str(t))]) != answer: | |
return | |
print(n) | |
for n in range(10000): | |
inner(n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment