From 6d3583f9811d2c7b184d0197c78e6f20cfc93549 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Thu, 26 May 2022 00:43:29 -0700 Subject: move difficulty-to-stdev logic to lib --- dartboat.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'dartboat.c') 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); } } -- cgit v1.2.3-70-g09d2