exercism/c/darts/darts.c
2024-08-13 17:09:15 -04:00

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;
}