Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for The Square Chest by Oleg_Domokeev
from typing import List
def checkio(lines_list: List[List[int]]) -> int:
lines_list = [sorted(connect) for connect in lines_list]
patterns = [[[i, i+1], [i, i+4], [i+1, i+5], [i+4, i+5]] for i in range(1, 12) if i%4] + \
[[[i, i+1], [i+1, i+2], [i+2, i+6], [i+6, i+10], [i, i+4], [i+4, i+8], [i+8, i+9], [i+9, i+10]] for i in([1, 2, 5, 6])] + \
[[[1,2], [2,3], [3,4], [4,8], [8,12], [12,16], [1,5], [5,9], [9,13], [13,14], [14,15], [15,16]]]
return sum(map(lambda x: all(elem in lines_list for elem in x), patterns))
Feb. 27, 2020
Comments: