Last active
July 31, 2021 18:39
-
-
Save zsoltk/f6d25f1fcbe07419d54aac4d4a193858 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Parcelize | |
object KnightsMoveCount : DatasetVisualisation { | |
override val name = R.string.viz_knight_move_count | |
override val minValue: Int = 2 | |
override val maxValue: Int = 8 | |
override fun dataPointAt(position: Position, state: GameSnapshotState): Datapoint { | |
val value = valueAt(position) | |
return Datapoint( | |
value = value, | |
label = value.toString(), | |
colorScale = Color.DarkGray to Color.Green | |
) | |
} | |
private fun valueAt(position: Position): Int = | |
when(position) { | |
a1 -> 2 | |
b1 -> 3 | |
c1 -> 4 | |
d1 -> 4 | |
e1 -> 4 | |
f1 -> 4 | |
g1 -> 3 | |
h1 -> 2 | |
// ... etc. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment