[ create a new paste ] login | about

Link: http://codepad.org/4MIFuRut    [ raw code | output | fork ]

scwizard - Python, pasted on Nov 18:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
def DeltaY(input):
	input = input - 1
	if down - (-1 * input) > up - input:
		return  -2 * (up - input)
	else:
		return ((-1 * input) - down) * 2 - 1

def DeltaX(input):
	input = input - 1
	if left - (-1 * input) > right - input:
		return  -2 * (right - input)
	else:
		return ((-1 * input) - left) * 2 - 1

up = 6
down = 19
left = 12
right = 11
print DeltaX(-3)
print DeltaY(4)


Output:
1
2
-17
-6


Create a new paste based on this one


Comments: