### added check_special_score() for 9, 10, and >=16

```added roll_dice()
 `@ -1,3 +1,96 @@` `"""game"""` ``` ``` `"this a test string"` `import random` `import time` ``` ``` `def check_special_score(score):` ` """` ``` ``` ` :param score:` ` :return:` ` """` ``` ``` ` if score == 9:` ` print("9 erreicht. Ende.")` ` return True, 0` ` elif score == 10:` ` print("10 erreicht. Noch ein letzter Wurf.")` ` time.sleep(3)` ` r = roll_dice()` ` print(r)` ` return True, score + sum(r)` ` elif score >= 16:` ` print("Sie haben 16 erreicht.")` ` return True, score` ` else:` ` return False, score` ``` ``` ``` ``` `def roll_dice(number=1, faces=6, seed=None):` ` """` ` Throws a certain number of dice iwth a certain number of faces.` ``` ``` ` :param number: Number of dice` ` :param faces: Number of faces of a die` ` :param seed: Number for random.seed() to reproduce randomness` ` :return: List of results` ` """` ` if seed:` ` random.seed(seed)` ``` ``` ` results = []` ``` ``` ` for n in range(number):` ` result = random.randint(1, faces)` ` results.append(result)` ``` ``` ` return results` ``` ``` ``` ``` `def sixteen_is_dead(players):` ` """` ``` ``` ` :param players:` ` :return:` ` """` ` all_results = []` ``` ``` ` for p in players:` ``` ``` ` if p[1]: # human player` ` button = input("Sie sind an der Reihe!")` ` player_score = 0` ``` ``` ` while button != "n":` ` current_roll = roll_dice()` ` print("Sie haben " + str(current_roll) + " gewürfelt!")` ` player_score += sum(current_roll)` ` print("Damit haben Sie insgesamt " + str(player_score) + " gewürfelt.")` ``` ``` ` button, player_score = check_special_score(player_score)` ``` ``` ` if button:` ` break` ``` ``` ` button = input("Wollen Sie weiterwürfeln?")` ``` ``` ` all_results.append(player_score)` ``` ``` ` else: # AI` ` pass` ``` ``` ` print(all_results)` ``` ``` ``` ``` `if __name__ == "__main__":` ` name = input("Wie heißen Sie?")` ` player_number = input("Gegen wie viele Personen wollen Sie spielen?")` ``` ``` ` players = []` ` human = (name, True)` ` players.append(human)` ``` ``` ` for p in player_number:` ` players.append(("P" + str(p), False))` ``` ``` ` sixteen_is_dead(players)`