Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
20-liner: mono solution in Clear category for Mono Captcha by przemyslaw.daniel
from itertools import product
FONT = ("XX----X-XXX-XXX-X-X-XXX--XX-XXX-XXX--XX",
"X-X--XX---X---X-X-X-X---X-----X-X-X-X-X",
"X-X---X--XX--X--XXX-XX--XXX--X--XXX-XXX",
"X-X---X-X-----X---X---X-X-X-X---X-X---X",
"-XX---X-XXX-XXX---X-XX---XX-X---XXX-XX-")
def is_digit_at_position(pos, digit, image):
r = product(range(5), range(3))
out = [{'X': 1, '-': 0}[FONT[i][j+digit*4]] ==
image[i][j+pos] for i, j in r]
return out.count(True) >= 14
def checkio(image):
r = product(range(len(image[0])-2), range(10))
out = [str(j) for i, j in r
if is_digit_at_position(i, j, image)]
return int("".join(out))
Oct. 30, 2016