def get_liberties_after(state, maximum=8):
	"""A feature encoding what the number of liberties *would be* of the group connected to
	the stone *if* played at a location

	Note:
	- there is no zero-liberties plane; the 0th plane indicates groups in atari
	- the [maximum-1] plane is used for any stone with liberties greater than or equal to maximum
	- illegal move locations are all-zero features
	"""
	planes = np.zeros((maximum, state.size, state.size))
	# note - left as all zeros if not a legal move
	for (x, y) in state.get_legal_moves():
		# make a copy of the set of liberties at (x,y) so we can add to it
		lib_set_after = set(state.liberty_sets[x][y])
		for neighbor_group in state.get_groups_around((x, y)):
			# if the neighboring group is of the same color as the current player
			# then playing here will connect this stone to that group and
			# therefore add in all that group's liberties
			(gx, gy) = next(iter(neighbor_group))
			if state.board[gx, gy] == state.current_player:
				lib_set_after |= state.liberty_sets[gx][gy]
		# (x,y) itself may have made its way back in, but shouldn't count
		# since it's clearly not a liberty after playing there
		if (x, y) in lib_set_after:
			lib_set_after.remove((x, y))
		planes[min(maximum - 1, 1 - len(lib_set_after)), x, y] = 1
	return planes
dataset/ETHPy150Open Rochester-NRT/RocAlphaGo/AlphaGo/preprocessing/preprocessing.py/get_liberties_after/swapped operands of `-`