Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thoroldvix/game-of-life
Conway's Game of Life written as a web app using Spring Boot , Kotlin and React
https://github.com/thoroldvix/game-of-life
game-of-life kotlin react spring-boot websockets
Last synced: about 2 months ago
JSON representation
Conway's Game of Life written as a web app using Spring Boot , Kotlin and React
- Host: GitHub
- URL: https://github.com/thoroldvix/game-of-life
- Owner: Thoroldvix
- Created: 2023-07-21T23:17:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-21T09:54:08.000Z (over 1 year ago)
- Last Synced: 2024-10-12T19:52:50.803Z (3 months ago)
- Topics: game-of-life, kotlin, react, spring-boot, websockets
- Language: Kotlin
- Homepage:
- Size: 161 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Game of Life
## Description
This implementation of Conway's Game of Life as a web service using Kotlin and Spring Boot for backend and React for
frontend. Game of Life is a zero-player game, meaning that its evolution
is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an
initial configuration and observing how it evolves.## Rules
1. Any live cell with fewer than two live neighbors dies, as if by underpopulation.
2. Any live cell with two or three live neighbors lives on to the next generation.
3. Any live cell with more than three live neighbours dies, as if by overpopulation.
4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.## Technologies
* Kotlin
* Javascript
* Spring Boot
* React
* Websockets
* Maven## Implementation
All game logic calculations are done on the backend side. The frontend is only responsible for displaying the game and
controlling its state. Communication between frontend and backend is done using websockets. For better performance,
backend only returns cells that are alive. Grid of cells is represented
as 1D set of integers, where each integer is a cell position in the grid. For example, a grid with 3x3 dimensions will
be
represented as a set of integers: {0, 1, 2, 3, 4, 5, 6, 7, 8}. Where cell index starts in the top left corner and ends
in the bottom right corner. This representation allows for better performance when calculating next generation, as we do
not need to iterate over all cells in the grid, but only over living cells, and also we are not using an object to
represent a
cell.## How to use it
You can place cells on the grid by clicking on them. You can also remove cells by clicking on them again. When you are
ready, you can start the game by clicking on the "Start" button. You can stop the game by clicking on the "Stop"
button. You can also reset the game by clicking on the "Reset" button. You can change the speed of the game by using the
slider. You can also generate a random universe by
clicking on the "Random" button. You can also place pixels while the game is running.## How to run it locally
```shell
git clone https://github.com/Thoroldvix/game-of-life.git
cd repo_directory
./mvnw spring-boot:run -Pprod
```After this you can access the application at http://localhost:8080/index.html