From 19944f71e18d51e6f9c406cf89e1aa51c3f92eb4 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 17 Apr 2023 19:46:52 -0700 Subject: [PATCH] scores increment to verify paper --- src/scores.h | 2 +- src/scores.re.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/scores.h b/src/scores.h index c49de55..1e6f49d 100644 --- a/src/scores.h +++ b/src/scores.h @@ -3,7 +3,7 @@ struct score { struct pair key, name; union date32 date, last; - unsigned edges; + unsigned edges, tempscore; }; #define ARRAY_NAME scorelist diff --git a/src/scores.re.c b/src/scores.re.c index 5ed951c..5eaadca 100644 --- a/src/scores.re.c +++ b/src/scores.re.c @@ -5,7 +5,6 @@ #if 0 #include /* C99 */ -#include #include #endif @@ -120,7 +119,7 @@ static int scan(union date32 date, const char *const buffer, score->key.a = s0, score->key.b = s1; score->name.a = 0, score->name.b = 0; score->date.u32 = score->last.u32 = 0; - score->edges = 0; + score->edges = 0, score->tempscore = 0; date32_to_string(date, &datestr); fprintf(stderr, "%s: new score <%.*s> stored in list at %zu.\n", datestr, (int)(s1 - s0), s0, *idx); @@ -207,11 +206,13 @@ int main(void) { fprintf(stderr, "Scores: %s.\n", scores_to_string(&scrs)); if(scores_is_empty(&scrs)) { fail = "scores failed to parse"; goto catch; } -#if 1 struct score_tree_iterator it = score_tree_iterator(&scrs.dates); union line64 line; struct score *score; + /* Set score to zero to verify count with paper journal. */ + for(size_t i = 0; i < scrs.list.size; i++) scrs.list.data[i].tempscore = 0; + printf("set terminal pngcairo dashed transparent truecolor" " size 840, 480 fontscale 1\n" "set output \"score.png\"\n"); @@ -222,8 +223,9 @@ int main(void) { score = scrs.list.data + *score_tree_value(&it); char datestr[12]; date32_to_string(line.date, &datestr); - printf("%s, %.*s\n", datestr, - (int)(score->key.b - score->key.a), score->key.a); + score->tempscore++; + printf("%s, %.*s, %u\n", datestr, + (int)(score->key.b - score->key.a), score->key.a, score->tempscore); } printf("EOD\n" "# theozh https://stackoverflow.com/a/75466214/2472827\n" @@ -266,7 +268,6 @@ int main(void) { " (total/2.): \\\n" " (getIndex(strcol(2))) w boxxy lc var lw 1, \\\n" " for [i=1:words(Uniqs)] keyentry w boxxy lc i ti Uniq(i)\n"); -#endif goto finally; catch: