# Background

A spider web is defined by

* "rings" numbered out from the centre as `0`, `1`, `2`, `3`, `4`


* "radials" labelled clock-wise from the top as `A`, `B`, `C`, `D`, `E`, `F`, `G`, `H`

Here is a picture to help explain:





# Web Coordinates

As you can see, each point where the rings and the radials intersect can be described by a "web coordinate".

So in this example the spider is at `H3` and the fly is at `E2`


# Kata Task

Our friendly jumping spider is resting and minding his own spidery business at web-coordinate `spider`.

An inattentive fly bumbles into the web at web-coordinate `fly` and gets itself stuck.

Your task is to calculate and return **the 
 distance** the spider must jump to get to the fly.

# Example

The solution to the scenario described by the picture is ``4.63522``

# Notes

* The centre of the web will always be referred to as `A0` 
* The rings intersect the radials at **evenly** spaced distances of **1 unit**


____


Good Luck!DM

Source: codewars | Difficulty: EASY

Starter code: def spider_to_fly(spider, fly):
	

Solutions:
import math

def spider_to_fly(spider, fly):
	web = {'A': 0, 'B': 45, 'C': 90, 'D': 135, 'E': 180, 'F': 225, 'G': 270, 'H': 315}
	angle = min(abs(web[spider[0]] - web[fly[0]]), 360 - abs(web[spider[0]] - web[fly[0]]))
	(sideA, sideB) = (int(spider[1]), int(fly[1]))
	return math.sqrt(sideA ** 2 + sideB ** 2 - 2 * sideA * sideB * math.cos(angle * math.pi / 180))


from math import cos, pi

def spider_to_fly(a, b):
	(x, y) = (int(a[1]), int(b[1]))
	return (x ** 2 + y ** 2 - 2 * x * y * cos((ord(a[0]) - ord(b[0])) * pi / 4)) ** 0.5


def spider_to_fly(spider, fly):
	from cmath import exp, pi, rect

	def coordinates(hexpoint):
		(t, r) = hexpoint
		return rect(int(r), 'ABCDEFGH'.index(t) * pi / 4)
	return abs(coordinates(spider) - coordinates(fly))


import math as m
import string as str

def spider_to_fly(spider, fly):
	if spider == fly:
		return 0
	else:
		angle = get_angle(spider[0], fly[0])
		s_dist = int(spider[1])
		f_dist = int(fly[1])
		return m.sqrt(s_dist ** 2 + f_dist ** 2 - 2 * s_dist * f_dist * m.cos(m.radians(angle)))

def get_angle(s, f):
	s_angle = str.ascii_uppercase.index(s) * 45
	f_angle = str.ascii_uppercase.index(f) * 45
	return abs(s_angle - f_angle)


from math import cos, radians, sin

def spider_to_fly(spider, fly):
	((ts, rs), (tf, rf)) = ((radians((ord(c) - 65) * 45), int(n)) for (c, n) in (spider, fly))
	return ((rs * cos(ts) - rf * cos(tf)) ** 2 + (rs * sin(ts) - rf * sin(tf)) ** 2) ** 0.5


import math

def spider_to_fly(spider, fly):
	angle_default = 45.0
	list_of_letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
	angle_multiplier = abs(list_of_letters.index(spider[0]) - list_of_letters.index(fly[0]))
	angle = angle_default * angle_multiplier * math.pi / 180
	sp_num = int(spider[1])
	fl_num = int(fly[1])
	answer = math.sqrt(sp_num ** 2 + fl_num ** 2 - sp_num * fl_num * 2 * math.cos(angle))
	return answer


from numpy import angle, abs, exp, pi

def spider_to_fly(*creatures):
	(a, b) = (int(x[1]) * exp(-1j * (ord(x[0]) - 3) / 4.0 * pi) for x in creatures)
	return abs(a - b)


from math import cos, hypot, pi, sin
from string import ascii_uppercase

def web_to_xy(c):
	(radial, ring) = c
	r = int(ring)
	angle = ascii_uppercase.find(radial) * pi / 4
	return (r * cos(angle), r * sin(angle))

def spider_to_fly(spider, fly):
	(sx, sy) = web_to_xy(spider)
	(fx, fy) = web_to_xy(fly)
	return round(hypot(sx - fx, sy - fy), 6)


from math import sqrt, cos, radians

def spider_to_fly(spider, fly):
	rad = radians((ord(spider[0]) - ord(fly[0])) % 8 * 45)
	(a, b) = (int(spider[1:]), int(fly[1:]))
	return sqrt(a ** 2 + b ** 2 - 2 * a * b * cos(rad))


from math import pi, cos

def spider_to_fly(spider, fly):
	a = int(spider[1])
	b = int(fly[1])
	return (a * a + b * b - 2 * a * b * cos((ord(spider[0]) - ord(fly[0])) / 4 * pi)) ** 0.5