<commit_before>/*
 * Flow-Design for Java
 *
 * Copyright (c) 2015 <NAME>
 * Released under the terms of the MIT License (MIT).
 */
package de.muspellheim.flowdesign.bowling;

import java.util.ArrayList;
import java.util.List;

public class BowlingGame {

    public static int calculateTotal(int... rolls) {
        List<Frame> frames = toFrames(rolls);
        frames = enrichFramesWithScore(frames);
        return calcTotal(frames);
    }

    static List<Frame> toFrames(int... rolls) {
        List<Frame> frames = new ArrayList<>();
        for (int i = 0; i < rolls.length; i++) {
            int roll1 = rolls[i];

            if (frames.size() < 9) {
                if (rolls[i] == 10) {
                    frames.add(new Frame(roll1));
                } else {
                    i++;
                    int roll2 = rolls[i];
                    frames.add(new Frame(roll1, roll2));
                }
            } else {
                if (rolls[i] + rolls[i + 1] < 10) {
                    i++;<commit_msg>TODOs aktualisiert<commit_after>/*
 * Flow-Design for Java
 *
 * Copyright (c) 2015 <NAME>
 * Released under the terms of the MIT License (MIT).
 */
package de.muspellheim.flowdesign.bowling;

import java.util.ArrayList;
import java.util.List;

public class BowlingGame {

    // TODO Code vereinfachen !!

    public static int calculateTotal(int... rolls) {
        List<Frame> frames = toFrames(rolls);
        frames = enrichFramesWithScore(frames);
        return calcTotal(frames);
    }

    static List<Frame> toFrames(int... rolls) {
        List<Frame> frames = new ArrayList<>();
        for (int i = 0; i < rolls.length; i++) {
            int roll1 = rolls[i];

            if (frames.size() < 9) {
                if (rolls[i] == 10) {
                    frames.add(new Frame(roll1));
                } else {
                    i++;
                    int roll2 = rolls[i];
                    frames.add(new Frame(roll1, roll2));
                }
            } else {
                if (rolls[i] + rolls[i + 1] < 10) {
                    i++;
{'fraction_non_alphanumeric': 0.12829104834849211, 'fraction_numerical': 0.015318334131163236, 'mean_word_length': 1.6256281407035176, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1564420', 'n_tokens_mistral': 652, 'n_tokens_neox': 596, 'n_words': 161}