int bowling_game_score(struct bowling_game *game) { int score = 0; int frame_index = 0; for (int frame = 0; frame < 10; ++frame) { if (is_strike(game, frame_index)) { score += strike_score(game, frame_index); frame_index += 1; } else if (is_spare(game, frame_index)) { score += spare_score(game, frame_index); frame_index += 2; } else { score += normal_score(game, frame_index); frame_index += 2; } } return score; }
static int score_fill_matrices (const double *theta, garch_container *DH) { int i, t, err; err = garch_etht(theta, DH); if (err) { return err; } normal_score(DH); for (t=DH->t1; t<=DH->t2; t++) { for (i=0; i<DH->k; i++) { DH->G[i][t] = DH->score_e[i][t] * DH->blockglue[0][t] + DH->score_h[i][t] * DH->blockglue[1][t]; } } return err; }