def get_capture_size(state, maximum=8):
	"""A feature encoding the number of opponent stones that would be captured by planing at each location,
	up to 'maximum'

	Note:
	- we currently *do* treat the 0th plane as "capturing zero stones"
	- the [maximum-1] plane is used for any capturable group of size greater than or equal to maximum-1
	- the 0th plane is used for legal moves that would not result in capture
	- illegal move locations are all-zero features
	"""
	planes = np.zeros((maximum, state.size, state.size))
	for (x, y) in state.get_legal_moves():
		# multiple disconnected groups may be captured. hence we loop over
		# groups and count sizes if captured.
		n_captured = 0
		for neighbor_group in state.get_groups_around((x, y)):
			# if the neighboring group is opponent stones and they have
			# one liberty, it must be (x,y) and we are capturing them
			# (note suicide and ko are not an issue because they are not
			# legal moves)
			(gx, gy) = next(iter(neighbor_group))
			if (state.liberty_counts[gx][gy] == 1) and (state.board[gx, gy] != state.current_player):
				n_captured += len(state.group_sets[gx][gy])
		planes[min(n_captured, maximum - 1), x, y] = 1
	return planes
dataset/ETHPy150Open Rochester-NRT/RocAlphaGo/AlphaGo/preprocessing/preprocessing.py/get_capture_size/original