static void find_best_thumb (void) { int frame = 0; float best_score = 0.0; frame_thumb = 0; for (frame = 0; frame < frame_end; frame++) { FrameInfo info; float score; GeglRectangle terrain_row; if (horizontal) terrain_row = (GeglRectangle){frame-frame_start, 0, 1, sizeof (FrameInfo)}; else terrain_row = (GeglRectangle){0, frame-frame_start, sizeof (FrameInfo), 1}; gegl_buffer_get (terrain, &terrain_row, 1.0, babl_format("RGB u8"), &info, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE); score = score_frame (&info, frame); if (score > best_score) { best_score = score; frame_thumb = frame; } } fprintf (stderr, "best frame: %i\n", frame_thumb); }
int BowlingGame::score() const { auto score = 0; for (auto frame = 0; frame < 10; ++frame){ score += score_frame(frame); } return score; }