Skip to content

Commit 7f4e980

Browse files
committed
Updating the approach for queen-attack after feedback
1 parent 3340b82 commit 7f4e980

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

exercises/practice/queen-attack/.approaches/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"introduction": {
33
"authors": [
44
"jagdish-15"
5+
],
6+
"contributors": [
7+
"kahgoh",
8+
"tasxatzial"
59
]
610
},
711
"approaches": [

exercises/practice/queen-attack/.approaches/difference-comparison/content.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ class QueenAttackCalculator {
2626

2727
## Explanation
2828

29-
1. **Constructor**:
29+
### Constructor
3030

31-
The constructor takes two `Queen` objects, `queen1` and `queen2`, and stores them as instance variables after validating the following conditions:
31+
The constructor takes two `Queen` objects, `queen1` and `queen2`, and stores them as instance variables after validating the following conditions:
3232

33-
- If either queen is `null`.
34-
- If both queens occupy the same position.
33+
- Either queen is `null`.
34+
- Both queens occupy the same position.
3535

36-
If either of these conditions is true, an exception is thrown.
36+
If either of these conditions is true, an exception is thrown.
3737

38-
2. **Method (`canQueensAttackOneAnother`)**:
38+
### `canQueensAttackOneAnother` Method
3939

40-
This method calculates the row and column differences between the two queens and checks the following conditions:
40+
This method calculates the row and column differences between the two queens and checks the following conditions:
4141

42-
- If the row difference is zero (the queens are on the same row).
43-
- If the column difference is zero (the queens are on the same column).
44-
- If the row and column differences are equal (the queens are on the same diagonal).
42+
- The row difference is zero (the queens are on the same row).
43+
- The column difference is zero (the queens are on the same column).
44+
- The row and column differences are equal (the queens are on the same diagonal).
4545

46-
If any of these conditions are true, the method returns `true`, indicating that the queens can attack each other.
46+
If any of these conditions are true, the method returns `true`, indicating that the queens can attack each other.

exercises/practice/queen-attack/.approaches/introduction.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ The task is to check if two queens, placed on specific coordinates, can attack e
88

99
The problem boils down to checking three conditions:
1010

11-
1. **Same Row**: If the queens are on the same row.
12-
2. **Same Column**: If the queens are on the same column.
13-
3. **Same Diagonal**: If the queens are on the same diagonal, i.e., the absolute difference between their row and column positions is equal.
11+
1. **Same Row**: The queens are on the same row.
12+
2. **Same Column**: The queens are on the same column.
13+
3. **Same Diagonal**: The queens are on the same diagonal, i.e., the absolute difference between their row and column positions is equal.
1414

1515
## Approach: Difference Comparison Approach
1616

0 commit comments

Comments
 (0)