Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edvincandon/rxoflife
πΎ game of life implementation in RXJS
https://github.com/edvincandon/rxoflife
reactive-programming rxjs
Last synced: 27 days ago
JSON representation
πΎ game of life implementation in RXJS
- Host: GitHub
- URL: https://github.com/edvincandon/rxoflife
- Owner: edvincandon
- Created: 2018-06-18T06:38:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-28T12:58:06.000Z (over 2 years ago)
- Last Synced: 2024-05-29T06:24:35.735Z (5 months ago)
- Topics: reactive-programming, rxjs
- Language: JavaScript
- Homepage: https://edvincandon.github.io/RXofLife/
- Size: 2.43 MB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# πΎπΎπΎ RXofLife πΎπΎπΎ
Game of life implementation in RXJS using canvas rendering. Could probably be optimized. **No for loops**.## Baking the cake
```shell
npm install
npm run dev # start the dev server
```
#### Tweak `MAX_CELLS` in `src/index.js` at your own risk to increase the max number of cells to be spawned. It defaults to 100,000.*Chrome might throw a fit and warn you about requestAnimationFrame handler violations - he's a nasty little lad*
## Deep dive
```shell
src
β
β-- index.js # streams and what not
β-- renderer.js # canvas rendering
β-- utils.js # all of them nasty functions
β-- shapes.js # custom shapes represented as lists of coords```
### Everything is a stream
Think of the game of life as a stream `reducing` over itself. The implementation is a little more complicated in order to optimize the rendering, but you get the idea.
```shell
------x-----------------------x----------------x->
[ 0, 0, 1, 0, [ 0, 0, 0, 0,
0, 0, 1, 0, ---> 0, 1, 1, 1, ---> ...
0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0 ] 0, 0, 0, 0 ]
```Oh and **no unit-tests**, sooooorry.
> "Testing is a poor substitute for proof" - Bartosz Milewski## Todo
- [ ] Add dropdown menu to select shapes