Implement Conway's Game-of-Life with Jetpack Compose Desktop
- Each cell is a
State<Boolean>
- Cells in root(0) geneneration are
mutableState
- Cells in child(1 and later) genenerations are
derivedState
of prev gen
Inspired by https://dev.to/zachklipp/scoped-recomposition-jetpack-compose-what-happens-when-state-changes-l78
- I never used Compose so I wanted to try
- To click each cell, desktop is better than mobile.
- Each generation looks Row x Column but actually LazyVerticalGrid to limit the composition scope to each cell.
- When I marked only one cell in Gen0, it dies in Gen1, so I expected derivedState doesn't calculate in Gen2 and later, but it actually does calculate for all Gen. why?