StatsReducer

Pure state transitions for StatsData — kept separate from I/O so they are unit-testable.

Properties

Link copied to clipboard
const val AWARD_LIMIT: Int = 100
Link copied to clipboard
const val HISTORY_LIMIT: Int = 200

Functions

Link copied to clipboard
fun awardsAt(data: StatsData, timestamp: Long): List<MedalAward>

Awards produced by the round recorded at timestamp.

Link copied to clipboard

Data saved before streak medals existed has no overall solo record; rebuild it (streaks included) by replaying solo history. Medals are not awarded retroactively.

Link copied to clipboard
Link copied to clipboard
fun outcomeFor(mark: Mark, winner: Mark?): Outcome
Link copied to clipboard
fun record(data: StatsData, result: MatchResult): StatsData
Link copied to clipboard
fun recordBlocks(data: StatsData, won: Boolean, score: Int, lines: Int): StatsData

A finished Blocks round. Three wins in a row unlocks Word Hive.

Link copied to clipboard
fun recordHive(data: StatsData, points: Int, words: Int, levelCleared: Boolean): StatsData

Words found in Word Hive; levelCleared moves you to the next level.

Link copied to clipboard

A duel won by a player on this phone.

Link copied to clipboard

A finished Ludo game from this phone's point of view.