Skip to content

Commit e0f7eb5

Browse files
committed
Adding uuid for approach of queen-attack exercise
1 parent db87438 commit e0f7eb5

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
{
2-
"introduction": {
2+
"introduction": {
3+
"authors": [
4+
"jagdish-15"
5+
]
6+
},
7+
"approaches": [
8+
{
9+
"uuid": "b2e474c8-b778-41e7-83c0-8e41cc84af9e",
10+
"slug": "simple-comparison",
11+
"title": "Simple Comparison Approach",
12+
"blurb": "Use basic comparison checks to determine if queens can attack each other.",
313
"authors": [
414
"jagdish-15"
515
]
6-
},
7-
"approaches": [
8-
{
9-
"uuid": "",
10-
"slug": "simple-comparison",
11-
"title": "Simple Comparison Approach",
12-
"blurb": "Use basic comparison checks to determine if queens can attack each other.",
13-
"authors": [
14-
"jagdish-15"
15-
]
16-
}
17-
]
18-
}
19-
16+
}
17+
]
18+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
boolean canQueensAttackOneAnother() {
2+
int rowDifference = Math.abs(queen1.getRow() - queen2.getRow());
3+
int columnDifference = Math.abs(queen1.getColumn() - queen2.getColumn());
4+
return rowDifference == 0 || columnDifference == 0 || rowDifference == columnDifference;
5+
}

0 commit comments

Comments
 (0)