Skip to content

EaseTheWorld/game_of_life_compose

Repository files navigation

Game of Life with Compose Desktop

Animation2 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

The reason I chose Compose Desktop

  • I never used Compose so I wanted to try
  • To click each cell, desktop is better than mobile.

Performance note

  • 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?

About

Implement Conway's Game-of-Life with Jetpack Compose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages