mirror of
https://codeberg.org/andyscott/exercism.git
synced 2024-11-13 23:00:47 -05:00
21 lines
337 B
C
21 lines
337 B
C
#include "darts.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
uint8_t score(coordinate_t point) {
|
|
const float distance_from_center = point.x * point.x + point.y * point.y;
|
|
|
|
if (distance_from_center > 100.F) {
|
|
return 0;
|
|
}
|
|
|
|
if (distance_from_center > 25.F) {
|
|
return 1;
|
|
}
|
|
|
|
if (distance_from_center > 1.F) {
|
|
return 5;
|
|
}
|
|
|
|
return 10;
|
|
}
|