def valid(snk, body, size, moves):
	"""
	Determines if a move is out of bound or in body
	"""
	# print("Snk is: ", snk)
	x = snk['x']
	y = snk['y']
	# print("Body is: ", body)
	b = []
	for item in body:
    
		b.append([item['x'], item['y']])

	for move in moves:
		if move == 'left':
			x -= 1
		elif move == 'right':
			x += 1
		elif move == 'up':
			y += 1
		elif move == 'down':
			y -= 1
    
	if not(0 <= x < size and 0 <= y < size):
		return False #out of bounds
	for item in b:
		if x == item[0] and y == item[1]:
			return False #body  
	return True