scores increment to verify paper

This commit is contained in:
Neil 2023-04-17 19:46:52 -07:00
parent 30f71b562c
commit 19944f71e1
2 changed files with 8 additions and 7 deletions

View File

@ -3,7 +3,7 @@
struct score {
struct pair key, name;
union date32 date, last;
unsigned edges;
unsigned edges, tempscore;
};
#define ARRAY_NAME scorelist

View File

@ -5,7 +5,6 @@
#if 0
#include <inttypes.h> /* C99 */
#include <stdlib.h>
#include <limits.h>
#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: