GameStatisticsRepository.kt
Ricky/android/blackjack/app/src/main/java/ca/medontime/blackjack/domain/repository/GameStatisticsRepository.kt
package ca.medontime.blackjack.domain.repository
import ca.medontime.blackjack.domain.model.GameStatistics
import kotlinx.coroutines.flow.Flow
/**
* Repository interface for managing game statistics
*/
interface GameStatisticsRepository {
/**
* Get current game statistics
*/
suspend fun getStatistics(): GameStatistics
/**
* Observe game statistics changes
*/
fun observeStatistics(): Flow<GameStatistics>
/**
* Update statistics after a game
*/
suspend fun updateStatistics(
gamesPlayed: Int = 0,
gamesWon: Int = 0,
gamesLost: Int = 0,
gamesPushed: Int = 0,
blackJacks: Int = 0,
highestScore: Int = 0,
totalScore: Int = 0,
currentStreak: Int = 0,
isWinningStreak: Boolean = true
)
/**
* Reset all statistics
*/
suspend fun resetStatistics()
/**
* Update statistics based on game result
*/
suspend fun updateStatisticsFromGameResult(
result: ca.medontime.blackjack.domain.model.GameResult,
playerScore: Int,
isBlackJack: Boolean
)
}
Articles liés
__init__.py
__init__.py — python source code from the Ricky learning materials (Ricky/Cat Project Final/back_web-4/app/__init__.py).
Lire l'article →auth.py
auth.py — python source code from the Ricky learning materials (Ricky/Cat Project Final/back_web-4/app/admin/auth.py).
Lire l'article →routes.py
routes.py — python source code from the Ricky learning materials (Ricky/Cat Project Final/back_web-4/app/admin/routes.py).
Lire l'article →config.py
config.py — python source code from the Ricky learning materials (Ricky/Cat Project Final/back_web-4/app/config.py).
Lire l'article →admin_ingest.py
admin_ingest.py — python source code from the Ricky learning materials (Ricky/Cat Project Final/back_web-4/app/routes/admin_ingest.py).
Lire l'article →admin_stats.py
admin_stats.py — python source code from the Ricky learning materials (Ricky/Cat Project Final/back_web-4/app/routes/admin_stats.py).
Lire l'article →