diff options
Diffstat (limited to 'dartboat.c')
-rw-r--r-- | dartboat.c | 37 |
1 files changed, 35 insertions, 2 deletions
@@ -157,16 +157,49 @@ void test_averages() } } +int comp_95(const void *a, const void *b) +{ + if (*(double *)a > *(double *)b) + return 1; + if (*(double *)a < *(double *)b) + return -1; + return 0; +} + +#define ROUNDS 1000000 +void test_95() +{ + for (int i = 8; i <= 88; i += 8) { + comp_set_difficulty(i); + + struct ccoords cc; + struct pcoords target = {0, 0}; + + double dists[ROUNDS]; + for (int i = 0; i < ROUNDS; ++i) + dists[i] = throw_dart(target, &cc).r; + qsort(dists, ROUNDS, sizeof(*dists), comp_95); + + int index = (int)(ROUNDS * 0.95) - 1; + + printf("%3d %5.2f %5.2f\n", + 10 * (i/8 + 1), + horizontal_stdev, + dists[index]); + } +} + int main() { srand(time(NULL)); init_board(); //cvc_curses_match(501); - pvc_curses_match(501); + //pvc_curses_match(501); //pvp_curses_match(501); - test_match(501); + //test_match(501); //test_averages(); + test_95(); return 0; } |