Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
override fun dataPointAt(position: Position, state: GameSnapshotState): Datapoint? =
valueAt(position, state)?.let { value ->
Datapoint(
value = value,
label = null,
colorScale = when (value) {
0 -> Color.Red.copy(alpha = 0.35f) to Color.Unspecified
else -> Color.Unspecified to Color.Unspecified
},
)
}
private fun valueAt(position: Position, state: GameSnapshotState): Int? =
when {
state.board[position].isEmpty -> null
else -> state.legalMovesFrom(position).size
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment