exercism:main ← exercism:add-relative-distance
opened 09:17PM - 08 Nov 26 UTC
Adds [Relative Distance](https://github.com/exercism/problem-specifications/tree…/main/exercises/relative-distance), which the Java track already has.
The API follows the Java track: the family tree goes to the constructor and the query is a method.
```scala
class RelativeDistance(familyTree: Map[String, List[String]]):
def degreeOfSeparation(personA: String, personB: String): Option[Int] = ???
```
"No known relationship" is `None`: the canonical data expects `null`, and the track already uses `Option` for "no answer" (e.g. binary-search). Java returns `-1` instead.
### Scala 3 syntax
The stub, the example and the test suite are written in the braceless style that `.scalafmt.conf` asks for (`removeOptionalBraces`, `convertToNewSyntax`). All three pass `scalafmt --test` with the track's config.
The suite is generated from the canonical data by `bin/generate-tests`. Its template doesn't use the shared `header` / `test_open` macros, because those still emit braces. It lays the suite out the way scalafmt would: wrapping at `maxColumn` (160), with trailing commas and the `->` arrows aligned as `align.preset = most` does. When the shared macros move to the braceless style, this template can switch back to them.
### Checked locally
- `bin/test relative-distance`: 7/7 against the example
- the stub compiles with the suite: the first test fails with `NotImplementedError`, the other six are pending
- `bin/generate-tests --check`, `configlet lint` and `configlet sync -e relative-distance` are clean
🤖 Generated with [Claude Code](https://claude.com/claude-code)