internal void WriteToScoreboard(string userInput, Yatzy spil, bool AddToPossibleOutcomesInstead = false) { int[] countOfEachDice = spil.CountOfEachDice(); if (spil.RoundCounter < 6) //altså når man spiller i upper section. { if (SingleNumberNumeric.ContainsKey(userInput)) { AddUpperToScoreboard(userInput, countOfEachDice, AddToPossibleOutcomesInstead); } } else //lower section {//ikke et switch statement fordi fx addPairToScoreboard er nemmere at samle som enkelt i stedet for flere forskellige cases i et swtich. //man kan nemlig ikke sige case 1,2,3: man kan kun sige case 1: case 2: osv. Så det er for at undgå at gentage kode. if (Pairs.ContainsKey(userInput)) { AddPairToScoreboard(userInput, countOfEachDice, AddToPossibleOutcomesInstead); } else if (OfAKind.ContainsKey(userInput)) { AddOfAKindToScoreboard(userInput, countOfEachDice, AddToPossibleOutcomesInstead); } else if (Straight.ContainsKey(userInput)) { AddStraightToScoreboard(userInput, countOfEachDice, AddToPossibleOutcomesInstead); } else if (userInput == "fuldt hus") { AddFuldHusToScoreboard(userInput, countOfEachDice, AddToPossibleOutcomesInstead); } else if (userInput == "yatzy") { AddYatzyToScoreboard(userInput, countOfEachDice, AddToPossibleOutcomesInstead); } else if (userInput == "chance") { AddChanceToScoreboard(userInput, countOfEachDice, AddToPossibleOutcomesInstead); } } }