Add game summary on client side

This commit is contained in:
Christoph Hagen
2021-12-21 11:16:54 +01:00
parent 941b25346d
commit b5cc395456
11 changed files with 46 additions and 10 deletions

View File

@ -2,7 +2,7 @@ import Foundation
struct EnglishGameSummarizer: GameSummarizer {
let game: GameStatistics
let game: GameSummary
private var winText: String {
game.didWin ? "won" : "lost"

View File

@ -2,7 +2,7 @@ import Foundation
protocol GameSummarizer {
init(game: GameStatistics)
init(game: GameSummary)
var text: String { get }
}

View File

@ -2,7 +2,7 @@ import Foundation
struct GermanGameSummarizer: GameSummarizer {
let game: GameStatistics
let game: GameSummary
var winText: String {
game.didWin ? "gewinnt" : "verliert"
@ -56,7 +56,7 @@ struct GermanGameSummarizer: GameSummarizer {
}
var text: String {
"\(game.leader) \(winText) \(gameText)\(coPlayerNames) mit \(game.leaderPoints) points. " +
"\(game.leader) \(winText) \(gameText)\(coPlayerNames) mit \(game.leaderPoints) Punkten. " +
"Das Spiel kostet \(costText)."
}
}