In the Python code using numpy 1.18.1
` def printBoard(self): current = self.player other = self.player % 2 + 1
currBin = '{:049b}'.format(self.current_position)
currRev = currBin[::-1]
cArr = (np.fromstring(currRev,'u1') - ord('0'))*current
other_position = self.current_position^self.mask
othBin = '{:049b}'.format(other_position)
othRev = othBin[::-1]
oArr = (np.fromstring(othRev,'u1') - ord('0'))*other
tArr = oArr+cArr
brd = np.reshape(tArr,(7,7),order = 'F')
for y in range(bitBoard.HEIGHT,-1,-1):
for x in range(bitBoard.WIDTH):
print(brd[y,x],end = ' ')
print()
print()
`
the line :
cArr = (np.fromstring(currRev,'u1') - ord('0'))*current
gives the following warning:
DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
cArr = (np.fromstring(currRev,'u1') - ord('0'))*current
Replacing 'fromstring' with 'frombuffer' gives the following error :
cArr = (np.frombuffer(currRev,'u1') - ord('0'))*current
TypeError: a bytes-like object is required, not 'str'
Despite some Googling I cannot find what I should use instead. Can anybody help?
Thank you.
Alan