Kotlin-Polytech / KotlinAsFirst

Задачи для онлайн-курса "Котлин как первый язык программирования"
Creative Commons Attribution Share Alike 4.0 International
74 stars 115 forks source link

findNearestCirclePair clarification #94

Closed gagarski closed 4 years ago

gagarski commented 4 years ago

We should clarify in which terms the circles should be nearest (Circle.distance or center.distance). Now it seems like we use the former.

Also we need to clarify what to do in case of multiple nearest pairs with equal distance (in case of Circle.distance it's quite often case since intersecting circles have zero distance). RandomTests suggest that we do not care which pair to choose but non-random tests suggest shoosing a specific pair:

        val c2 = Circle(Point(3.0, 0.0), 5.0)
        // ...
        val c4 = Circle(Point(0.0, 7.0), 3.0)
        val c5 = Circle(Point(0.0, -6.0), 4.0)
        // ...
        assertEquals(Pair(c2, c4), findNearestCirclePair(c2, c4, c5))