Changed piece representation to be square matrix for easier computation