Updated prints

This commit is contained in:
2025-08-23 18:46:06 +02:00
parent bc6c94afcf
commit 61a6d40be5

View File

@@ -105,31 +105,34 @@ class GameSession extends ChangeNotifier {
/// Every other player gets their round score. /// Every other player gets their round score.
void calculateScoredPoints( void calculateScoredPoints(
int roundNum, List<int> roundScores, int caboPlayerIndex) { int roundNum, List<int> roundScores, int caboPlayerIndex) {
print('Spieler: $players'); print('Spieler:');
print('Punkte: $roundScores'); for (int i = 0; i < players.length; i++) {
print('${players[caboPlayerIndex]} hat mit ${roundScores[caboPlayerIndex]} ' print(' ${players[i].name}: ${roundScores[i]} Punkte');
}
print(
'${players[caboPlayerIndex].name} hat mit ${roundScores[caboPlayerIndex]} '
'Punkten CABO gesagt'); 'Punkten CABO gesagt');
/// List of the index of the player(s) with the lowest score /// List of the index of the player(s) with the lowest score
List<int> lowestScoreIndex = _getLowestScoreIndex(roundScores); List<int> lowestScoreIndex = _getLowestScoreIndex(roundScores);
print('Folgende Spieler haben die niedrigsten Punte:'); print('Folgende Spieler haben die niedrigsten Punte:');
for (int i in lowestScoreIndex) { for (int i in lowestScoreIndex) {
print('${players[i]} (${roundScores[i]} Punkte)'); print('${players[i].name} (${roundScores[i]} Punkte)');
} }
// The player who said CABO is one of the players which have the // The player who said CABO is one of the players which have the
// fewest points. // fewest points.
if (lowestScoreIndex.contains(caboPlayerIndex)) { if (lowestScoreIndex.contains(caboPlayerIndex)) {
print('${players[caboPlayerIndex]} hat CABO gesagt ' print('${players[caboPlayerIndex].name} hat CABO gesagt '
'und bekommt 0 Punkte'); 'und bekommt 0 Punkte');
print('Alle anderen Spieler bekommen ihre Punkte'); print('Alle anderen Spieler bekommen ihre Punkte');
_assignPoints(roundNum, roundScores, caboPlayerIndex, [caboPlayerIndex]); _assignPoints(roundNum, roundScores, caboPlayerIndex, [caboPlayerIndex]);
} else { } else {
// A player other than the one who said CABO has the fewest points. // A player other than the one who said CABO has the fewest points.
print('${players[caboPlayerIndex]} hat CABO gesagt, ' print('${players[caboPlayerIndex].name} hat CABO gesagt, '
'jedoch nicht die wenigsten Punkte.'); 'jedoch nicht die wenigsten Punkte.');
print('Folgende:r Spieler haben die wenigsten Punkte:'); print('Folgende:r Spieler haben die wenigsten Punkte:');
for (int i in lowestScoreIndex) { for (int i in lowestScoreIndex) {
print('${players[i]}: ${roundScores[i]} Punkte'); print('${players[i].name}: ${roundScores[i]} Punkte');
} }
_assignPoints(roundNum, roundScores, caboPlayerIndex, lowestScoreIndex, _assignPoints(roundNum, roundScores, caboPlayerIndex, lowestScoreIndex,
caboPlayerIndex); caboPlayerIndex);
@@ -176,19 +179,19 @@ class GameSession extends ChangeNotifier {
List<int> scoreUpdates = [...roundScores]; List<int> scoreUpdates = [...roundScores];
print('Folgende Punkte wurden aus der Runde übernommen:'); print('Folgende Punkte wurden aus der Runde übernommen:');
for (int i = 0; i < scoreUpdates.length; i++) { for (int i = 0; i < scoreUpdates.length; i++) {
print('${players[i]}: ${scoreUpdates[i]}'); print('${players[i].name}: ${scoreUpdates[i]}');
} }
for (int i in winnerIndex) { for (int i in winnerIndex) {
print('${players[i]} hat gewonnen und bekommt 0 Punkte'); print('${players[i].name} hat gewonnen und bekommt 0 Punkte');
scoreUpdates[i] = 0; scoreUpdates[i] = 0;
} }
if (loserIndex != null) { if (loserIndex != null) {
print('${players[loserIndex]} bekommt 5 Fehlerpunkte'); print('${players[loserIndex].name} bekommt 5 Fehlerpunkte');
scoreUpdates[loserIndex] += 5; scoreUpdates[loserIndex] += 5;
} }
print('Aktualisierte Punkte:'); print('Aktualisierte Punkte:');
for (int i = 0; i < scoreUpdates.length; i++) { for (int i = 0; i < scoreUpdates.length; i++) {
print('${players[i]}: ${scoreUpdates[i]}'); print('${players[i].name}: ${scoreUpdates[i]}');
} }
print('scoreUpdates: $scoreUpdates, roundScores: $roundScores'); print('scoreUpdates: $scoreUpdates, roundScores: $roundScores');
addRoundScoresToList(roundNum, roundScores, scoreUpdates, caboPlayerIndex); addRoundScoresToList(roundNum, roundScores, scoreUpdates, caboPlayerIndex);
@@ -247,7 +250,7 @@ class GameSession extends ChangeNotifier {
if (players[i].totalScore > pointLimit) { if (players[i].totalScore > pointLimit) {
isGameFinished = true; isGameFinished = true;
limitExceeded = true; limitExceeded = true;
print('${players[i]} hat die 100 Punkte ueberschritten, ' print('${players[i].name} hat die 100 Punkte ueberschritten, '
'deswegen wurde das Spiel beendet'); 'deswegen wurde das Spiel beendet');
setWinner(); setWinner();
} }
@@ -283,7 +286,7 @@ class GameSession extends ChangeNotifier {
for (int i = 0; i < players.length; i++) { for (int i = 0; i < players.length; i++) {
if (players[i].totalScore == pointLimit) { if (players[i].totalScore == pointLimit) {
bonusPlayers.add(i); bonusPlayers.add(i);
print('${players[i]} hat genau 100 Punkte erreicht und bekommt ' print('${players[i].name} hat genau 100 Punkte erreicht und bekommt '
'deswegen ${(pointLimit / 2).round()} Punkte abgezogen'); 'deswegen ${(pointLimit / 2).round()} Punkte abgezogen');
roundList[roundNumber - 1].scoreUpdates[i] -= (pointLimit / 2).round(); roundList[roundNumber - 1].scoreUpdates[i] -= (pointLimit / 2).round();
} }