-
Notifications
You must be signed in to change notification settings - Fork 0
Adding manhattan-distance #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| } | ||
| } | ||
| //Send the result back to the main function | ||
| return SumOfManhattanDistance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Trailing spaces not allowed.
| return SumOfManhattanDistance; | |
| return SumOfManhattanDistance; |
|
|
||
| for (let i = 0; i < x.length; i++){ | ||
| for (let j = 0; j < x[i].length ; j++){ | ||
| //Compute the result of the Manhattan Distance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected exception block, space or tab after '//' in comment.
| //Compute the result of the Manhattan Distance | |
| // Compute the result of the Manhattan Distance |
|
|
||
| for (let i = 0; i < x.length; i++){ | ||
| for (let j = 0; j < x[i].length ; j++){ | ||
| //Compute the result of the Manhattan Distance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected indentation of 6 spaces but found 1 tab.
| //Compute the result of the Manhattan Distance | |
| //Compute the result of the Manhattan Distance |
| for (let j = 0; j < x[i].length ; j++){ | ||
| //Compute the result of the Manhattan Distance | ||
| SumOfManhattanDistance += (Math.abs(x[i] - x[j]) + Math.abs(y[i] - y[j])); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected indentation of 4 spaces but found 1 tab.
| } | |
| } |
| */ | ||
| export default function manhattanDistance(x, y) { | ||
|
|
||
| let SumOfManhattanDistance = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected indentation of 2 spaces but found 0.
| let SumOfManhattanDistance = 0; | |
| let SumOfManhattanDistance = 0; |
| describe('manhattanDistance', () => { | ||
| it('should calculate the manhattan distance', () => { | ||
| expect(manhattanDistance(1,5,1,8)).toEqual(1); | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected indentation of 2 spaces but found 4.
| }) | |
| }) |
| SumOfManhattanDistance += (Math.abs(x[i] - x[j]) + Math.abs(y[i] - y[j])); | ||
| } | ||
| } | ||
| //Send the result back to the main function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected exception block, space or tab after '//' in comment.
| //Send the result back to the main function | |
| // Send the result back to the main function |
| @@ -0,0 +1,19 @@ | |||
| //This function is calculate the manhattan distance | |||
| /** | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Trailing spaces not allowed.
| /** | |
| /** |
|
|
||
| let SumOfManhattanDistance = 0; | ||
|
|
||
| for (let i = 0; i < x.length; i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected indentation of 2 spaces but found 0.
| for (let i = 0; i < x.length; i++){ | |
| for (let i = 0; i < x.length; i++){ |
|
|
||
| describe('manhattanDistance', () => { | ||
| it('should calculate the manhattan distance', () => { | ||
| expect(manhattanDistance(1,5,1,8)).toEqual(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: A space is required after ','.
| expect(manhattanDistance(1,5,1,8)).toEqual(1); | |
| expect(manhattanDistance(1, 5,1,8)).toEqual(1); |
| let SumOfManhattanDistance = 0; | ||
|
|
||
| for (let i = 0; i < x.length; i++){ | ||
| for (let j = 0; j < x[i].length ; j++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Unexpected whitespace before semicolon.
| for (let j = 0; j < x[i].length ; j++){ | |
| for (let j = 0; j < x[i].length; j++){ |
| SumOfManhattanDistance += (Math.abs(x[i] - x[j]) + Math.abs(y[i] - y[j])); | ||
| } | ||
| } | ||
| //Send the result back to the main function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected indentation of 2 spaces but found 0.
| //Send the result back to the main function | |
| //Send the result back to the main function |
| for (let i = 0; i < x.length; i++){ | ||
| for (let j = 0; j < x[i].length ; j++){ | ||
| //Compute the result of the Manhattan Distance | ||
| SumOfManhattanDistance += (Math.abs(x[i] - x[j]) + Math.abs(y[i] - y[j])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected indentation of 6 spaces but found 1 tab.
| SumOfManhattanDistance += (Math.abs(x[i] - x[j]) + Math.abs(y[i] - y[j])); | |
| SumOfManhattanDistance += (Math.abs(x[i] - x[j]) + Math.abs(y[i] - y[j])); |
| @@ -0,0 +1,19 @@ | |||
| //This function is calculate the manhattan distance | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected exception block, space or tab after '//' in comment.
| //This function is calculate the manhattan distance | |
| // This function is calculate the manhattan distance |
No description provided.