Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions exercises/practice/darts/.approaches/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ import java.util.function.DoublePredicate;

class Darts {

final private static double innerRing = 1.0;
final private static double middleRing = 5.0;
final private static double outerRing = 10.0;
private static final double INNER_RING = 1.0;
private static final double MIDDLE_RING = 5.0;
private static final double OUTER_RING = 10.0;

int score(double x, double y) {
var pointRadius = (Math.sqrt((x * x) + (y * y)));
DoublePredicate thrownOutside = ring -> pointRadius > ring;

if (thrownOutside.test(outerRing))
if (thrownOutside.test(OUTER_RING))
return 0;
if (thrownOutside.test(middleRing))
if (thrownOutside.test(MIDDLE_RING))
return 1;
if (thrownOutside.test(innerRing))
if (thrownOutside.test(INNER_RING))
return 5;
return 10;
}
Expand Down