my solution to this code fights problem
https://app.codesignal.com/arcade/intro/level-6/t97bpjfrMDZH8GJhi/description
generates an odd and even offset board and checks their reference values
Given two cells on the standard chess board, determine whether they have the same color or not.
def chessBoardCellColor(cell1, cell2):
[fooa, foob] = cell1
[bara, barb] = cell2
fooa = ord(fooa) % 2
foob = int(foob) % 2
bara = ord(bara) % 2
barb = int(barb) % 2
board = [[(i+1)%2 for i in range(0,9)], [i%2 for i in range(0,9)]]
return True if board[fooa][foob] == board[bara][barb] else False
Top comments (0)