Add more stats, getting ready for release 2

This commit is contained in:
Aidan Haas
2022-12-28 15:42:38 -05:00
committed by GitHub
parent ccfec88c41
commit bf32b63e0e
3 changed files with 70 additions and 16 deletions
+15 -1
View File
@@ -107,10 +107,24 @@ int save_stats(FILE *stats_file, Stat_struct *stats) {
int i;
for (i = 0; i < NUM_STATS; i++) {
fprintf(stats_file, "%f\n", stats->data[i]);
fprintf(stats_file, "%d\n", stats->data[i]);
}
fclose(stats_file);
return SUCCESS;
}
/* Finds highest WPM score */
int update_max_wpm(Stat_struct *stats) {
int i, max = stats->data[W_5];
for (i = W_5; i <= W_100; i++) {
if (max < stats->data[i]) {
max = stats->data[i];
}
}
stats->data[BEST_WPM] = max;
return SUCCESS;
}