-
-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding uuid for approach of queen-attack exercise
- Loading branch information
1 parent
db87438
commit e0f7eb5
Showing
2 changed files
with
19 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
{ | ||
"introduction": { | ||
"introduction": { | ||
"authors": [ | ||
"jagdish-15" | ||
] | ||
}, | ||
"approaches": [ | ||
{ | ||
"uuid": "b2e474c8-b778-41e7-83c0-8e41cc84af9e", | ||
"slug": "simple-comparison", | ||
"title": "Simple Comparison Approach", | ||
"blurb": "Use basic comparison checks to determine if queens can attack each other.", | ||
"authors": [ | ||
"jagdish-15" | ||
] | ||
}, | ||
"approaches": [ | ||
{ | ||
"uuid": "", | ||
"slug": "simple-comparison", | ||
"title": "Simple Comparison Approach", | ||
"blurb": "Use basic comparison checks to determine if queens can attack each other.", | ||
"authors": [ | ||
"jagdish-15" | ||
] | ||
} | ||
] | ||
} | ||
|
||
} | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
exercises/practice/queen-attack/.approaches/simple-comparison/snippet.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
boolean canQueensAttackOneAnother() { | ||
int rowDifference = Math.abs(queen1.getRow() - queen2.getRow()); | ||
int columnDifference = Math.abs(queen1.getColumn() - queen2.getColumn()); | ||
return rowDifference == 0 || columnDifference == 0 || rowDifference == columnDifference; | ||
} |