Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Translate and get solution in Speedy category for Identify Block by davidcaron
POSITIONS = {
(1, 2, 3, 4): 'I',
(1, 5, 9, 13): 'I',
(2, 6, 9, 10): 'J',
(1, 2, 3, 7): 'J',
(1, 2, 5, 9): 'J',
(1, 5, 6, 7): 'J',
(1, 5, 9, 10): 'L',
(1, 2, 3, 5): 'L',
(1, 2, 6, 10): 'L',
(3, 5, 6, 7): 'L',
(1, 2, 5, 6): 'O',
(2, 3, 5, 6): 'S',
(1, 5, 6, 10): 'S',
(1, 2, 3, 6): 'T',
(1, 5, 6, 9): 'T',
(2, 5, 6, 10): 'T',
(2, 5, 6, 7): 'T',
(1, 2, 6, 7): 'Z',
(2, 5, 6, 9): 'Z',
}
def identify_block(numbers):
x_delta = min((n - 1) % 4 for n in numbers)
y_delta = (min(numbers) - 1) // 4
translated_numbers = [n - x_delta - y_delta * 4 for n in numbers]
return POSITIONS.get(tuple(sorted(translated_numbers)))
March 7, 2018