We're sorry if it sounds too noob. But this is our life's first encounter with Python.
We have got a python function like this:
def m(n,k,c=0):x,y=n;return c if n==k else 7*(c>6)or min(m((x+a,y+b),k,c+1)for a,b in[(1,2),(1,-2),(-1,2),(-1,-2),(2,1),(2,-1),(-2,1),(-2,-1)])
which is being called like this:
print m((1,2), (5,6))
In order to understand it we were trying to add line breaks like this:
def m(n,k,c=0):x,y=n;return c
if n==k else 7*(c>6) or min(m((x+a,y+b),k,c+1)for a,b in[(1,2),(1,-2),(-1,2),(-1,-2),(2,1),(2,-1),(-2,1),(-2,-1)])
We're not understanding why is just a simple new line breaking the code
Once we understand this, probably we shall be able to convert this program to javascript:
function m(n, k, c = 0) {
x,
y = n;
return c
if (n == k) {
} else {
7 * (c > 6) or Math.min(m((x + a, y + b), k, c + 1) for a, b in [(1, 2), (1, -2), (-1, 2), (-1, -2), (2, 1), (2, -1), (-2, 1), (-2, -1)])
}
}