trackler 2.2.1.51 → 2.2.1.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/saddle-points/description.md +1 -1
  4. data/tracks/cfml/.gitattributes +19 -0
  5. data/tracks/cfml/config.json +180 -186
  6. data/tracks/cfml/tasks/FormatConfig.cfc +26 -0
  7. data/tracks/cfml/tasks/ScaffoldExercise.cfc +1 -1
  8. data/tracks/common-lisp/config.json +26 -9
  9. data/tracks/common-lisp/exercises/acronym/README.md +61 -0
  10. data/tracks/common-lisp/exercises/acronym/acronym-test.lisp +48 -0
  11. data/tracks/common-lisp/exercises/acronym/acronym.lisp +6 -0
  12. data/tracks/common-lisp/exercises/acronym/example.lisp +24 -0
  13. data/tracks/common-lisp/exercises/isogram/README.md +65 -0
  14. data/tracks/common-lisp/exercises/isogram/example.lisp +18 -0
  15. data/tracks/common-lisp/exercises/isogram/isogram-test.lisp +39 -0
  16. data/tracks/common-lisp/exercises/isogram/isogram.lisp +8 -0
  17. data/tracks/delphi/exercises/etl/README.md +1 -1
  18. data/tracks/delphi/exercises/rna-transcription/README.md +1 -1
  19. data/tracks/delphi/exercises/saddle-points/README.md +1 -1
  20. data/tracks/fsharp/exercises/all-your-base/AllYourBaseTest.fs +21 -21
  21. data/tracks/fsharp/exercises/kindergarten-garden/Example.fs +13 -14
  22. data/tracks/fsharp/exercises/kindergarten-garden/KindergartenGarden.fs +1 -3
  23. data/tracks/fsharp/exercises/kindergarten-garden/KindergartenGardenTest.fs +9 -41
  24. data/tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs +12 -12
  25. data/tracks/fsharp/exercises/rna-transcription/RnaTranscriptionTest.fs +8 -8
  26. data/tracks/fsharp/exercises/robot-simulator/RobotSimulator.fs +3 -0
  27. data/tracks/fsharp/exercises/robot-simulator/RobotSimulatorTest.fs +129 -26
  28. data/tracks/fsharp/generators/Common.fs +10 -0
  29. data/tracks/fsharp/generators/Exercise.fs +5 -1
  30. data/tracks/fsharp/generators/Generators.fs +122 -33
  31. data/tracks/fsharp/generators/Output.fs +6 -1
  32. data/tracks/haskell/exercises/crypto-square/README.md +6 -4
  33. data/tracks/haskell/exercises/kindergarten-garden/README.md +10 -10
  34. data/tracks/haskell/exercises/saddle-points/README.md +1 -1
  35. data/tracks/haskell/exercises/space-age/README.md +1 -1
  36. data/tracks/java/config.json +8 -2
  37. data/tracks/java/exercises/queen-attack/.meta/src/reference/java/BoardCoordinate.java +12 -12
  38. data/tracks/java/exercises/queen-attack/.meta/src/reference/java/QueenAttackCalculator.java +14 -14
  39. data/tracks/java/exercises/queen-attack/.meta/version +1 -1
  40. data/tracks/java/exercises/queen-attack/src/test/java/QueenAttackCalculatorTest.java +11 -11
  41. data/tracks/javascript/exercises/prime-factors/example.js +10 -9
  42. data/tracks/julia/config.json +12 -0
  43. data/tracks/julia/exercises/run-length-encoding/README.md +31 -0
  44. data/tracks/julia/exercises/run-length-encoding/example.jl +22 -0
  45. data/tracks/julia/exercises/run-length-encoding/run-length-encoding.jl +7 -0
  46. data/tracks/julia/exercises/run-length-encoding/runtests.jl +29 -0
  47. data/tracks/objective-c/README.md +79 -1
  48. data/tracks/ocaml/config.json +430 -433
  49. data/tracks/ocaml/config/maintainers.json +11 -11
  50. data/tracks/php/config.json +16 -0
  51. data/tracks/php/exercises/all-your-base/README.md +31 -0
  52. data/tracks/php/exercises/all-your-base/all-your-base_test.php +135 -0
  53. data/tracks/php/exercises/all-your-base/example.php +27 -0
  54. data/tracks/php/exercises/series/README.md +21 -0
  55. data/tracks/php/exercises/series/example.php +15 -0
  56. data/tracks/php/exercises/series/series_test.php +64 -0
  57. data/tracks/python/README.md +1 -1
  58. data/tracks/python/config.json +4 -1
  59. data/tracks/python/exercises/forth/forth.py +4 -0
  60. data/tracks/python/exercises/forth/forth_test.py +1 -1
  61. data/tracks/python/exercises/markdown/example.py +1 -1
  62. data/tracks/python/exercises/markdown/markdown_test.py +3 -3
  63. data/tracks/ruby/exercises/two-bucket/.meta/.version +1 -1
  64. data/tracks/ruby/exercises/two-bucket/.meta/solutions/two_bucket.rb +23 -3
  65. data/tracks/ruby/exercises/two-bucket/two_bucket_test.rb +4 -4
  66. metadata +22 -2
@@ -57,6 +57,16 @@ module Option =
57
57
  | :? int32 as i -> if i < 0 then None else Some value
58
58
  | _ -> None
59
59
 
60
+ let ofNonFalse (value: obj) =
61
+ match value with
62
+ | :? bool as b when not b -> None
63
+ | _ -> Some value
64
+
65
+ let ofNonError (value: obj) =
66
+ match value with
67
+ | :? JToken as jToken when not (isNull jToken.["error"]) -> None
68
+ | _ -> Some value
69
+
60
70
  module String =
61
71
  open Humanizer
62
72
 
@@ -50,6 +50,7 @@ type Exercise() =
50
50
  abstract member RenderSutProperty : CanonicalDataCase -> string
51
51
 
52
52
  // Utility methods to customize rendered output
53
+ abstract member Properties : CanonicalDataCase -> string list
53
54
  abstract member PropertiesUsedAsSutParameter : CanonicalDataCase -> string list
54
55
  abstract member PropertiesWithIdentifier : CanonicalDataCase -> string list
55
56
  abstract member IdentifierTypeAnnotation: CanonicalDataCase * string * obj -> string option
@@ -214,11 +215,14 @@ type Exercise() =
214
215
 
215
216
  default this.RenderSutProperty canonicalDataCase = string canonicalDataCase.Property
216
217
 
218
+ default this.Properties canonicalDataCase =
219
+ List.append (this.PropertiesUsedAsSutParameter canonicalDataCase) ["expected"]
220
+
217
221
  default this.PropertiesUsedAsSutParameter canonicalDataCase =
218
222
  canonicalDataCase.Properties
219
223
  |> Map.toList
220
224
  |> List.map fst
221
- |> List.except ["property"; "expected"; "description"; "comments"]
225
+ |> List.except ["expected"; "property"; "description"; "comments"]
222
226
 
223
227
  // Utility methods to customize rendered output
224
228
 
@@ -18,7 +18,7 @@ type AllYourBase() =
18
18
 
19
19
  override this.RenderExpected (canonicalDataCase, key, value) = value |> Option.ofObj |> formatValue
20
20
 
21
- override this.PropertiesWithIdentifier canonicalDataCase = ["expected"; "input_base"; "input_digits"; "output_base"]
21
+ override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
22
22
 
23
23
  type Allergies() =
24
24
  inherit Exercise()
@@ -72,8 +72,7 @@ type BookStore() =
72
72
  override this.RenderExpected (canonicalDataCase, key, value) = formatFloat value
73
73
 
74
74
  override this.PropertiesUsedAsSutParameter canonicalDataCase =
75
- base.PropertiesUsedAsSutParameter canonicalDataCase
76
- |> List.except ["targetgrouping"; "expected"; "description"]
75
+ base.PropertiesUsedAsSutParameter canonicalDataCase |> List.except ["targetgrouping"]
77
76
 
78
77
  type BracketPush() =
79
78
  inherit Exercise()
@@ -81,15 +80,11 @@ type BracketPush() =
81
80
  type Change() =
82
81
  inherit Exercise()
83
82
 
84
- override this.MapCanonicalDataCaseProperty (canonicalDataCase, key, value) =
85
- match key with
86
- | "expected" ->
87
- match value with
88
- | :? JArray -> Option.ofObj value |> box
89
- | _ -> value |> Option.ofNonNegativeInt |> box
90
- | _ -> base.MapCanonicalDataCaseProperty (canonicalDataCase, key, value)
83
+ override this.RenderExpected (canonicalDataCase, key, value) =
84
+ let convertToOption = if value :? JArray then Option.ofObj else Option.ofNonNegativeInt
85
+ value |> convertToOption |> formatValue
91
86
 
92
- override this.PropertiesWithIdentifier canonicalDataCase = ["coins"; "target"; "expected"]
87
+ override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
93
88
 
94
89
  override this.IdentifierTypeAnnotation (canonicalDataCase, key, value) =
95
90
  match key with
@@ -145,12 +140,7 @@ type KindergartenGarden() =
145
140
  |> Seq.map toPlant
146
141
  |> formatList
147
142
 
148
- override this.RenderSutProperty canonicalDataCase =
149
- match Map.containsKey "students" canonicalDataCase.Properties with
150
- | true -> "plantsForCustomStudents"
151
- | false -> "plantsForDefaultStudents"
152
-
153
- override this.PropertiesWithIdentifier canonicalDataCase = ["student"; "students"; "diagram"; "expected"]
143
+ override this.PropertiesWithIdentifier canonicalDataCase = ["student"; "diagram"; "expected"]
154
144
 
155
145
  override this.UseFullMethodName canonicalDataCase = true
156
146
 
@@ -160,9 +150,10 @@ type LargestSeriesProduct() =
160
150
  override this.PropertiesWithIdentifier canonicalDataCase = ["digits"]
161
151
 
162
152
  override this.RenderExpected (canonicalDataCase, key, value) =
163
- match value :?> int64 with
164
- | -1L -> "None"
165
- | _ -> value :?> int64 |> sprintf "(Some %d)"
153
+ value
154
+ |> Option.ofNonNegativeInt
155
+ |> formatValue
156
+ |> parenthesizeOption
166
157
 
167
158
  type Leap() =
168
159
  inherit Exercise()
@@ -179,7 +170,7 @@ type Minesweeper() =
179
170
  |> Seq.map formatValue
180
171
  |> formatMultiLineList
181
172
 
182
- override this.PropertiesWithIdentifier canonicalDataCase = ["input"; "expected"]
173
+ override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
183
174
 
184
175
  override this.IdentifierTypeAnnotation (canonicalDataCase, key, value) =
185
176
  match value :?> JArray |> Seq.isEmpty with
@@ -190,9 +181,10 @@ type NthPrime() =
190
181
  inherit Exercise()
191
182
 
192
183
  override this.RenderExpected (canonicalDataCase, key, value) =
193
- match string value with
194
- | "False" -> "None"
195
- | _ -> value :?> int64 |> sprintf "(Some %d)"
184
+ value
185
+ |> Option.ofNonFalse
186
+ |> formatValue
187
+ |> parenthesizeOption
196
188
 
197
189
  type Pangram() =
198
190
  inherit Exercise()
@@ -200,12 +192,14 @@ type Pangram() =
200
192
  type PerfectNumbers() =
201
193
  inherit Exercise()
202
194
 
195
+ let toClassification value = string value |> String.humanize
196
+
203
197
  override this.RenderExpected (canonicalDataCase, key, value) =
204
- match value |> string with
205
- | "perfect" -> "(Some Perfect)"
206
- | "abundant" -> "(Some Abundant)"
207
- | "deficient" -> "(Some Deficient)"
208
- | _ -> "None"
198
+ value
199
+ |> Option.ofNonError
200
+ |> Option.map toClassification
201
+ |> formatOption
202
+ |> parenthesizeOption
209
203
 
210
204
  type PascalsTriangle() =
211
205
  inherit Exercise()
@@ -230,7 +224,10 @@ type PhoneNumber() =
230
224
  inherit Exercise()
231
225
 
232
226
  override this.RenderExpected (canonicalDataCase, key, value) =
233
- value |> Option.ofObj |> formatValue |> backwardPipe
227
+ value
228
+ |> Option.ofObj
229
+ |> formatValue
230
+ |> parenthesizeOption
234
231
 
235
232
  type PigLatin() =
236
233
  inherit Exercise()
@@ -263,18 +260,110 @@ type QueenAttack() =
263
260
  type RailFenceCipher() =
264
261
  inherit Exercise()
265
262
 
266
- override this.PropertiesWithIdentifier canonicalDataCase = ["rails"; "msg"; "expected"]
267
-
268
263
  override this.PropertiesUsedAsSutParameter canonicalDataCase = ["rails"; "msg"]
269
264
 
265
+ override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
266
+
270
267
  type Raindrops() =
271
268
  inherit Exercise()
272
269
 
270
+ type RobotSimulator() =
271
+ inherit Exercise()
272
+
273
+ let resultIdentifierName = "actual"
274
+
275
+ override this.PropertiesWithIdentifier canonicalDataCase = ["robot"; "property"; "expected"]
276
+
277
+ member private this.RenderDirection (value: JToken) =
278
+ sprintf "%s" (value.ToObject<string>() |> String.upperCaseFirst)
279
+
280
+ member private this.RenderCoords (coords: JToken) =
281
+ (coords.["x"].ToObject<int>(), coords.["y"].ToObject<int>())
282
+ |> formatValue
283
+
284
+ member private this.DefineRobot (direction: JToken) (coords: JToken) =
285
+ sprintf "createRobot %s %s" (this.RenderDirection direction) (this.RenderCoords coords)
286
+
287
+ member private this.GetRobotProperties (value : JToken) =
288
+ value.SelectToken("direction"), value.SelectToken("position")
289
+
290
+ override this.RenderArrange canonicalDataCase =
291
+ // one identifier may be empty if we only checking created object
292
+ // we need to filter out this empty line
293
+ base.RenderArrange canonicalDataCase
294
+ |> List.choose (
295
+ function
296
+ | "" -> None
297
+ | v -> Some v
298
+ )
299
+
300
+ override this.RenderValueWithoutIdentifier (canonicalDataCase, key, value) =
301
+ match key with
302
+ | "robot" ->
303
+ let input = value :?> JToken
304
+ this.DefineRobot ("direction" |> input.SelectToken) ("position" |> input.SelectToken)
305
+ | "expected" ->
306
+ // here we may need to render full robot object
307
+ // or just coordinate/direction values
308
+ let input = value :?> JToken
309
+ let direction, position = this.GetRobotProperties input
310
+ match isNull direction, isNull position with
311
+ | true, false ->
312
+ this.RenderCoords position
313
+ | false, true ->
314
+ this.RenderDirection direction
315
+ | false, false ->
316
+ this.DefineRobot ("direction" |> input.SelectToken) ("position" |> input.SelectToken)
317
+ | true, true ->
318
+ ""
319
+ | _ -> ""
320
+
321
+ override this.RenderValueWithIdentifier (canonicalDataCase, key, value) =
322
+ match key with
323
+ | "property" ->
324
+ let action = value :?> string
325
+ match action with
326
+ | "instructions" ->
327
+ sprintf "let %s = simulate robot %s" resultIdentifierName (canonicalDataCase.Properties.["instructions"] |> formatValue)
328
+ | "create" ->
329
+ ""
330
+ | _ ->
331
+ sprintf "let %s = %s robot" resultIdentifierName action
332
+
333
+ | _ ->
334
+ base.RenderValueWithIdentifier (canonicalDataCase, key, value)
335
+
336
+ override this.RenderSut canonicalDataCase =
337
+ match canonicalDataCase.Property with
338
+ | "create" ->
339
+ "robot"
340
+ | _ ->
341
+ // depends on expected value we may need to
342
+ // check whole robot or just one of its' properties
343
+ let direction, position = this.GetRobotProperties (canonicalDataCase.Properties.["expected"] :?> JToken)
344
+ match isNull direction, isNull position with
345
+ | true, false ->
346
+ sprintf "%s.coordinate" resultIdentifierName
347
+ | false, true ->
348
+ sprintf "%s.bearing" resultIdentifierName
349
+ | true, true ->
350
+ resultIdentifierName
351
+ | false, false ->
352
+ match canonicalDataCase.Property with
353
+ | "create" -> "robot"
354
+ | _ -> resultIdentifierName
355
+
356
+ override this.RenderTestMethodName canonicalDataCase =
357
+ // avoid duplicated method names
358
+ // for this generator it is preferable
359
+ // because useFullMethodName leads to very long names
360
+ sprintf "%s - %s" canonicalDataCase.Property (canonicalDataCase.Description |> String.upperCaseFirst)
361
+
273
362
  type RnaTranscription() =
274
363
  inherit Exercise()
275
364
 
276
365
  override this.RenderExpected (canonicalDataCase, key, value) =
277
- value |> Option.ofObj |> formatValue |> backwardPipe
366
+ value |> Option.ofObj |> formatValue |> parenthesizeOption
278
367
 
279
368
  type RunLengthEncoding() =
280
369
  inherit Exercise()
@@ -16,9 +16,14 @@ let indent level value =
16
16
 
17
17
  let parenthesize value = sprintf "(%s)" value
18
18
 
19
+ let parenthesizeOption value =
20
+ match value with
21
+ | "None" -> value
22
+ | _ -> parenthesize value
23
+
19
24
  let backwardPipe value = sprintf "<| %s" value
20
25
 
21
- let backwardPipeConditional test value = if test value then backwardPipe value else value
26
+ let backwardPipeIf test value = if test value then backwardPipe value else value
22
27
 
23
28
  let addTypeAnnotation typeAnnotation value = sprintf "%s: %s" value typeAnnotation
24
29
 
@@ -45,12 +45,14 @@ The message above is coded as:
45
45
  imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
46
46
  ```
47
47
 
48
- Output the encoded text in chunks. Phrases that fill perfect squares
49
- `(r X r)` should be output in `r`-length chunks separated by spaces.
50
- Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows.
48
+ Output the encoded text in chunks. Phrases that fill perfect rectangles
49
+ `(r X c)` should be output `c` chunks of `r` length, separated by spaces.
50
+ Phrases that do not fill perfect rectangles will have `n` empty spaces.
51
+ Those spaces should be distributed evenly, added to the end of the last
52
+ `n` chunks.
51
53
 
52
54
  ```text
53
- imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
55
+ imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
54
56
  ```
55
57
 
56
58
  Notice that were we to stack these, we could visually decode the
@@ -3,19 +3,19 @@
3
3
  Given a diagram, determine which plants each child in the kindergarten class is
4
4
  responsible for.
5
5
 
6
- The kindergarten class is learning about growing plants. The teachers
6
+ The kindergarten class is learning about growing plants. The teacher
7
7
  thought it would be a good idea to give them actual seeds, plant them in
8
8
  actual dirt, and grow actual plants.
9
9
 
10
10
  They've chosen to grow grass, clover, radishes, and violets.
11
11
 
12
- To this end, they've put little styrofoam cups along the window sills,
13
- and planted one type of plant in each cup, choosing randomly from the
14
- available types of seeds.
12
+ To this end, the children have put little cups along the window sills, and
13
+ planted one type of plant in each cup, choosing randomly from the available
14
+ types of seeds.
15
15
 
16
16
  ```text
17
17
  [window][window][window]
18
- ........................ # each dot represents a styrofoam cup
18
+ ........................ # each dot represents a cup
19
19
  ........................
20
20
  ```
21
21
 
@@ -25,8 +25,8 @@ There are 12 children in the class:
25
25
  - Eve, Fred, Ginny, Harriet,
26
26
  - Ileana, Joseph, Kincaid, and Larry.
27
27
 
28
- Each child gets 4 cups, two on each row. The children are assigned to
29
- cups in alphabetical order.
28
+ Each child gets 4 cups, two on each row. Their teacher assigns cups to
29
+ the children alphabetically by their names.
30
30
 
31
31
  The following diagram represents Alice's plants:
32
32
 
@@ -36,12 +36,12 @@ VR......................
36
36
  RG......................
37
37
  ```
38
38
 
39
- So in the row nearest the window, she has a violet and a radish; in the
40
- row behind that, she has a radish and some grass.
39
+ In the first row, nearest the windows, she has a violet and a radish. In the
40
+ second row she has a radish and some grass.
41
41
 
42
42
  Your program will be given the plants from left-to-right starting with
43
43
  the row nearest the windows. From this, it should be able to determine
44
- which plants belong to which students.
44
+ which plants belong to each student.
45
45
 
46
46
  For example, if it's told that the garden looks like so:
47
47
 
@@ -15,7 +15,7 @@ So say you have a matrix like so:
15
15
  It has a saddle point at (1, 0).
16
16
 
17
17
  It's called a "saddle point" because it is greater than or equal to
18
- every element in its row and the less than or equal to every element in
18
+ every element in its row and less than or equal to every element in
19
19
  its column.
20
20
 
21
21
  A matrix may have zero or more saddle points.
@@ -12,7 +12,7 @@ Given an age in seconds, calculate how old someone would be on:
12
12
  - Neptune: orbital period 164.79132 Earth years
13
13
 
14
14
  So if you were told someone were 1,000,000,000 seconds old, you should
15
- be able to say that they're 31 Earth-years old.
15
+ be able to say that they're 31.69 Earth-years old.
16
16
 
17
17
  If you're wondering why Pluto didn't make the cut, go watch [this
18
18
  youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs).
@@ -917,7 +917,13 @@
917
917
  "core": false,
918
918
  "difficulty": 8,
919
919
  "slug": "ocr-numbers",
920
- "topics": null,
920
+ "topics": [
921
+ "exception_handling",
922
+ "loops",
923
+ "lists",
924
+ "strings",
925
+ "parsing"
926
+ ],
921
927
  "unlocked_by": "robot-name",
922
928
  "uuid": "5cbc6a67-3a53-4aad-ae68-ff469525437f"
923
929
  },
@@ -1102,4 +1108,4 @@
1102
1108
  ],
1103
1109
  "language": "Java",
1104
1110
  "solution_pattern": "reference"
1105
- }
1111
+ }
@@ -1,27 +1,27 @@
1
- public final class BoardCoordinate {
1
+ final class BoardCoordinate {
2
2
 
3
- private final int rank;
3
+ private final int row;
4
4
 
5
- private final int file;
5
+ private final int column;
6
6
 
7
- public BoardCoordinate(final int rank, final int file) throws IllegalArgumentException {
8
- this.rank = rank;
9
- this.file = file;
7
+ BoardCoordinate(final int row, final int column) throws IllegalArgumentException {
8
+ this.row = row;
9
+ this.column = column;
10
10
 
11
11
  validateInputs();
12
12
  }
13
13
 
14
- public int getRank() {
15
- return rank;
14
+ int getRow() {
15
+ return row;
16
16
  }
17
17
 
18
- public int getFile() {
19
- return file;
18
+ int getColumn() {
19
+ return column;
20
20
  }
21
21
 
22
22
  private void validateInputs() throws IllegalArgumentException {
23
- validateCoordinateComponent(rank, "rank");
24
- validateCoordinateComponent(file, "file");
23
+ validateCoordinateComponent(row, "row");
24
+ validateCoordinateComponent(column, "column");
25
25
  }
26
26
 
27
27
  private void validateCoordinateComponent(final int value, final String componentName)
@@ -1,10 +1,10 @@
1
- public final class QueenAttackCalculator {
1
+ final class QueenAttackCalculator {
2
2
 
3
3
  private final BoardCoordinate whiteQueenCoordinate;
4
4
 
5
5
  private final BoardCoordinate blackQueenCoordinate;
6
6
 
7
- public QueenAttackCalculator(final BoardCoordinate whiteQueenCoordinate, final BoardCoordinate blackQueenCoordinate)
7
+ QueenAttackCalculator(final BoardCoordinate whiteQueenCoordinate, final BoardCoordinate blackQueenCoordinate)
8
8
  throws IllegalArgumentException {
9
9
 
10
10
  this.whiteQueenCoordinate = whiteQueenCoordinate;
@@ -13,8 +13,8 @@ public final class QueenAttackCalculator {
13
13
  validateInputs();
14
14
  }
15
15
 
16
- public boolean canQueensAttackOneAnother() {
17
- return queensShareFile() || queensShareRank() || queensShareDiagonal();
16
+ boolean canQueensAttackOneAnother() {
17
+ return queensShareColumn() || queensShareRow() || queensShareDiagonal();
18
18
  }
19
19
 
20
20
  private void validateInputs() throws IllegalArgumentException {
@@ -27,28 +27,28 @@ public final class QueenAttackCalculator {
27
27
  }
28
28
  }
29
29
 
30
- private boolean queensShareRank() {
31
- return differenceBetweenRanks() == 0;
30
+ private boolean queensShareRow() {
31
+ return differenceBetweenRows() == 0;
32
32
  }
33
33
 
34
- private boolean queensShareFile() {
35
- return differenceBetweenFiles() == 0;
34
+ private boolean queensShareColumn() {
35
+ return differenceBetweenColumns() == 0;
36
36
  }
37
37
 
38
38
  private boolean queensShareBoardCoordinate() {
39
- return queensShareRank() && queensShareFile();
39
+ return queensShareRow() && queensShareColumn();
40
40
  }
41
41
 
42
42
  private boolean queensShareDiagonal() {
43
- return differenceBetweenRanks() == differenceBetweenFiles();
43
+ return differenceBetweenRows() == differenceBetweenColumns();
44
44
  }
45
45
 
46
- private int differenceBetweenRanks() {
47
- return Math.abs(whiteQueenCoordinate.getRank() - blackQueenCoordinate.getRank());
46
+ private int differenceBetweenRows() {
47
+ return Math.abs(whiteQueenCoordinate.getRow() - blackQueenCoordinate.getRow());
48
48
  }
49
49
 
50
- private int differenceBetweenFiles() {
51
- return Math.abs(whiteQueenCoordinate.getFile() - blackQueenCoordinate.getFile());
50
+ private int differenceBetweenColumns() {
51
+ return Math.abs(whiteQueenCoordinate.getColumn() - blackQueenCoordinate.getColumn());
52
52
  }
53
53
 
54
54
  }