def unpack_state(self, s, shape):
a = np.fromstring(s, dtype=np.uint8)
a = np.unpackbits(a)
a = a.reshape(shape[0], -1)
a = a[:, :shape[1]]
b = np.zeros_like(a[0], np.int)
b[a[0] == 1] = Board.STONE_BLACK
b[a[1] == 1] = Board.STONE_WHITE
b[a[2] == 1] = Board.STONE_EMPTY
return b
评论列表
文章目录