Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aboisvert/tetris-zio
A simple Tetris game showcasing functional programmign with Scala and ZIO
https://github.com/aboisvert/tetris-zio
Last synced: 20 days ago
JSON representation
A simple Tetris game showcasing functional programmign with Scala and ZIO
- Host: GitHub
- URL: https://github.com/aboisvert/tetris-zio
- Owner: aboisvert
- Created: 2020-01-26T16:31:53.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-08T16:37:51.000Z (almost 4 years ago)
- Last Synced: 2024-10-28T17:20:12.815Z (2 months ago)
- Language: Scala
- Size: 17.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
tetris-zio
============This is a falling block game (Tetris clone) written in Scala using the ZIO library to manage state in a purely functional way.
The entire codebase is written in pure FP style with no variables and no mutable datastructures. It illustrates case-class copying, (tail-) recursive state updates, side-effecting operations using ZIO Tasks and ZIO Schedule to trigger timer ticks and a just a couple ZIO `unsafeRun` sections for integration with the side-effecting Swing library.
## credits & attribution
The codebase is a hard-fork from https://github.com/eed3si9n/tetrix.scala. It was heavily simplified to be a more compact example of using ZIO. The module structure was reduced to a single module and the Android bits were discarded. The existing codebase already followed a functional style. The code was further cleaned up and tidied according to the author's (@aboisvert) style and taste and the effectful parts were moved into ZIO context, in particular moving all mutable state into a ZIO `Actor`.
The license remains MIT and copyright attribution can be obtained from the fork point at https://github.com/eed3si9n/tetrix.scala/commit/2bde9e2e1188300576980c729a05e63d2b7bd0b0. Any code differences are copyright (c) 2020, Alex Boisvert.
How to build
------------Use sbt. To run swing UI:
```
> sbt run
```License
-------MIT License.