Пример #1
0
	def draw_snakes(self):
		"""Draws snakes present on board."""
		for snake in self.board.get_snakes():
			snake_body_points = snake.get_body_points()
			#print snake_body_points
			color = snake.get_color()
			for point in snake_body_points[:-1]:
				self.surface.blit(self.snake_body_icon[color], (point.get_x()*self.scale, point.get_y()*self.scale))
			snake_mouth = snake_body_points[-1]
			self.surface.blit(self.snake_mouth_icon[color][snake.get_direction()], (snake_mouth.get_x()*self.scale, snake_mouth.get_y()*self.scale))
def encrypt_snake(snake):
	"""Returns encrpted Body list to send over netowrk."""
	enc_data = "%%body%%"
	for point in snake.get_body_points():
		enc_data += str(point.get_x()) + "%%sep_xy%%"
		enc_data += str(point.get_y())
		enc_data += "%%eop%%"
	enc_data += "%%body%%"
	enc_data += "%%dir%%"
	enc_data += snake.get_direction()
	enc_data += "%%dir%%"
	enc_data += "%%color%%"
	enc_data += snake.get_color()
	enc_data += "%%color%%"
	return enc_data