summaryrefslogtreecommitdiff
path: root/dartboat.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-26 00:43:29 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-26 00:43:29 -0700
commit6d3583f9811d2c7b184d0197c78e6f20cfc93549 (patch)
treef44a42e043bba8159bb7634563d45097c537a5b0 /dartboat.c
parent656be88ba3b0db383101449d7d2f09348601d7d7 (diff)
downloaddartboat-6d3583f9811d2c7b184d0197c78e6f20cfc93549.tar.gz
dartboat-6d3583f9811d2c7b184d0197c78e6f20cfc93549.tar.xz
move difficulty-to-stdev logic to lib
Diffstat (limited to 'dartboat.c')
-rw-r--r--dartboat.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/dartboat.c b/dartboat.c
index fdaf6d1..952b5b7 100644
--- a/dartboat.c
+++ b/dartboat.c
@@ -138,21 +138,22 @@ void test_averages()
{
int rounds = 100000;
- for (int stdev = 4; stdev < 25; ++stdev) {
- horizontal_stdev = vertical_stdev = stdev;
+ for (int diff = 0; diff <= 99; ++diff) {
+ comp_set_difficulty(diff);
int darts = 0;
for (int i = 0; i < rounds; ++i) {
struct leg *l = leg_init(501);
while (l->rem > 0)
comp_visit(l);
- leg_free(l);
darts += (l->n_visits - 1) * 3 +
l->visits[l->n_visits-1].n_darts;
+ leg_free(l);
}
- printf("%d %f\n", stdev, (double)(501*rounds)/darts*3);
+ printf("%d %f %f\n", diff, horizontal_stdev,
+ (double)(501 * rounds) / darts * 3);
}
}