Background
----------
In another dimension, there exist two immortal brothers: Solomon and Goromon. As sworn loyal subjects to the time elemental, Chronixus, both Solomon and Goromon were granted the power to create temporal folds. By sliding through these temporal folds, one can gain entry to parallel dimensions where time moves relatively faster or slower.

Goromon grew dissatisfied and one day betrayed Chronixus by stealing the Temporal Crystal, an artifact used to maintain the time continuum. Chronixus summoned Solomon and gave him the task of tracking down Goromon and retrieving the Temporal Crystal.

Using a map given to Solomon by Chronixus, you must find Goromon's precise location.

Mission Details
---------------
The map is represented as a 2D array. See the example below:

```python
map_example = [[1,3,5],[2,0,10],[-3,1,4],[4,2,4],[1,1,5],[-3,0,12],[2,1,12],[-2,2,6]]
```
Here are what the values of each subarray represent:
- **Time Dilation:** With each additional layer of time dilation entered, time slows by a factor of `2`. At layer `0`, time passes normally. At layer `1`, time passes at half the rate of layer `0`. At layer `2`, time passes at half the rate of layer `1`, and therefore one quarter the rate of layer `0`.
- **Directions** are as follow: `0 = North, 1 = East, 2 = South, 3 = West`
- **Distance Traveled:** This represents the distance traveled relative to the current time dilation layer. See below:

```
The following are equivalent distances (all equal a Standard Distance of 100):
Layer: 0, Distance: 100
Layer: 1, Distance: 50
Layer: 2, Distance: 25
```
For the `mapExample` above:
```
mapExample[0] -> [1,3,5]
1 represents the level shift of time dilation
3 represents the direction
5 represents the distance traveled relative to the current time dilation layer

Solomon's new location becomes [-10,0]

mapExample[1] -> [2,0,10]
At this point, Solomon has shifted 2 layers deeper.
He is now at time dilation layer 3.
Solomon moves North a Standard Distance of 80.
Solomon's new location becomes [-10,80]

mapExample[2] -> [-3,1,4]
At this point, Solomon has shifted out 3 layers.
He is now at time dilation layer 0.
Solomon moves East a Standard Distance of 4.
Solomon's new location becomes [-6,80]
```
Your function should return Goromon's `[x,y]` coordinates.

For `mapExample`, the correct output is `[346,40]`.

Additional Technical Details
----------------------------
- Inputs are always valid.
- Solomon begins his quest at time dilation level `0`, at `[x,y]` coordinates `[0,0]`.
- Time dilation level at any point will always be `0` or greater.
- Standard Distance is the distance at time dilation level `0`.
- For given distance `d` for each value in the array: `d >= 0`.
- Do not mutate the input

**Note from the author:** I made up this story for the purpose of this kata. Any similarities to any fictitious persons or events are purely coincidental.

If you enjoyed this kata, be sure to check out [my other katas](https://www.codewars.com/users/docgunthrop/authored).

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def solomons_quest(arr):
	

Solutions:
def solomons_quest(arr):
	(pos, lvl) = ([0, 0], 0)
	for (dilat, dir, dist) in arr:
		lvl += dilat
		pos[dir in [0, 2]] += dist * 2 ** lvl * (-1) ** (dir in [2, 3])
	return pos


def solomons_quest(arr):
	level = 0
	ds = [1j, 1, -1j, -1]
	pos = 0
	for (level_shift, direction, distance) in arr:
		level += level_shift
		pos += 2 ** level * (ds[direction] * distance)
	return [int(pos.real), int(pos.imag)]


class Direction:
	North = 0
	East = 1
	South = 2
	West = 3

class Solomon:
	curDir = Direction.North
	xLoc = 0
	yLoc = 0
	timeDepth = 0
	timeFactor = 2

def unpackWayPoint(wayPoint):
	amountTimeDialation = wayPoint[0]
	newDir = wayPoint[1]
	distToTravel = wayPoint[2]
	return (amountTimeDialation, newDir, distToTravel)

def updateHeroDistance(hero, dirOfTravel, trueDistToMove):
	if dirOfTravel == Direction.North:
		hero.yLoc += trueDistToMove
	elif dirOfTravel == Direction.South:
		hero.yLoc -= trueDistToMove
	elif dirOfTravel == Direction.East:
		hero.xLoc += trueDistToMove
	else:
		hero.xLoc -= trueDistToMove

def printDist(hero):
	print(("Hero's location: [", hero.xLoc, ',', hero.yLoc, ']'))

def solomons_quest(wayPoints):
	hero = Solomon()
	for nextStop in wayPoints:
		(amtTimeDialation, dirOfTravel, amtToTravel) = unpackWayPoint(nextStop)
		hero.timeDepth += amtTimeDialation
		trueDistToMove = hero.timeFactor ** hero.timeDepth * amtToTravel
		updateHeroDistance(hero, dirOfTravel, trueDistToMove)
	heroFinalLoc = [hero.xLoc, hero.yLoc]
	return heroFinalLoc


def solomons_quest(arr):
	(d, count, out) = ({0: 1, 1: 1, 2: -1, 3: -1}, 0, [0, 0])
	for i in arr:
		count += i[0]
		x = 2 ** count * d[i[1]] * i[2]
		if i[1] % 2 == 1:
			out[0] += x
		else:
			out[1] += x
	return out


def solomons_quest(arr):
	south_north = 0
	east_west = 0
	layer = 0
	for el in arr:
		layer += el[0]
		if el[1] == 0:
			south_north += el[2] * 2 ** layer
		elif el[1] == 2:
			south_north -= el[2] * 2 ** layer
		elif el[1] == 1:
			east_west += el[2] * 2 ** layer
		elif el[1] == 3:
			east_west -= el[2] * 2 ** layer
	return [east_west, south_north]


def solomons_quest(arr):
	d_t = 0
	loc = [0, 0]
	for r in arr:
		d_t += r[0]
		if r[1] > 1:
			loc[3 % r[1]] -= r[2] * 2 ** d_t
		else:
			loc[(r[1] + 1) % 2] += r[2] * 2 ** d_t
	return loc


def solomons_quest(arr):
	(l, c) = (0, [0, 0])
	for way in arr:
		l += way[0]
		c[(way[1] + 1) % 2] += (-1) ** (way[1] // 2) * way[2] * 2 ** l
	return c


def solomons_quest(arr):
	layer = 0
	coord = [0, 0]
	for i in arr:
		layer = layer + i[0]
		if i[1] == 0:
			coord[1] = coord[1] + i[2] * 2 ** layer
		if i[1] == 1:
			coord[0] = coord[0] + i[2] * 2 ** layer
		if i[1] == 2:
			coord[1] = coord[1] - i[2] * 2 ** layer
		if i[1] == 3:
			coord[0] = coord[0] - i[2] * 2 ** layer
	return coord


def solomons_quest(arr):
	layer = x = y = 0
	for (l, dir_, distance) in arr:
		layer = [layer + l, 0][layer + l < 0]
		(inc, dec, r) = ([1, 0, -1, 0][dir_], [0, 1, 0, -1][dir_], distance * 2 ** layer)
		x += inc * r
		y += dec * r
	return [y, x]


MOVE = [lambda d, x, y, l: (x, y + d, l), lambda d, x, y, l: (x + d, y, l), lambda d, x, y, l: (x, y - d, l), lambda d, x, y, l: (x - d, y, l)]

def solomons_quest(arr):
	x = y = l = 0
	for (a, b, c) in arr:
		(x, y, l) = MOVE[b](c * 2 ** (l + a), x, y, l + a)
	return [x, y]