exercism/c/darts/darts.c

22 lines
337 B
C
Raw Normal View History

2024-08-13 17:09:15 -04:00
#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;
}