Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for The Square Chest by gflegar
def checkio(lines_list):
total = 0
h = lambda x: [x + 1, x + 2] in lines_list or [x + 2, x + 1] in lines_list
v = lambda x: [x + 1, x + 5] in lines_list or [x + 5, x + 1] in lines_list
for i in range(16):
for j in range(1, min(4 - i % 4, 4 - i // 4) + 1):
total += all([h(i + k) and v(i + 4*k) and h(i + 4*j + k) and v(i + j + 4*k) for k in range(j)])
return total
Jan. 25, 2014
Comments: