mirror of
https://codeberg.org/andyscott/exercism.git
synced 2024-11-14 15:20:48 -05:00
22 lines
337 B
C
22 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;
|
||
|
}
|