A tetris engine written in rust
Project description
Tetris
A tetris engine python package powered by rust
- Handles the tetris game logic for you so you can focus on building a tetris interface
- Provides flexibility for the game loop, allowing you to define the game loop entirely or run a built-in game loop thread in the background
- The built-in, multithreaded game loop capability makes use of rust's safe concurrency offering
Install the package
Install from pypi
pip install tetris_engine
Install directly from this repository
pip install http://www.github.com/peter-lucia/tetris_engine/archive/main.zip
Example usage:
from time import sleep
from tetris_engine import Tetris, Direction
def run_singlethreaded():
"""
You control the game loop as well as the game speed
"""
tetris = Tetris()
while tetris.is_game_running():
tetris.move(direction=Direction.Down.value)
for row in tetris.read_game():
print(row)
print()
sleep(1)
def run_multithreaded():
"""
You control the user controls of the game but the
game loop runs in a background thread
"""
tetris = Tetris(multithreaded=True)
while tetris.is_game_running():
tetris.read_game()
for row in tetris.read_game():
print(row)
print()
sleep(.5)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tetris_engine-0.3.4.tar.gz
(23.8 MB
view details)
Built Distribution
File details
Details for the file tetris_engine-0.3.4.tar.gz
.
File metadata
- Download URL: tetris_engine-0.3.4.tar.gz
- Upload date:
- Size: 23.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e97b732a2edc0d50a584dff56ae55e3edda39db614a932bd14a0b83cf72a3049 |
|
MD5 | a77f15bc6baccb189562d02b676d9f61 |
|
BLAKE2b-256 | 89b68070df67ead5131013063df98c44cb4a3a8123b848814eb83cd0044ee000 |
File details
Details for the file tetris_engine-0.3.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: tetris_engine-0.3.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 245.1 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0eebcc65717dc0a322add7d3118117106f57d33990c640506696e2bde6cb572 |
|
MD5 | b8316de97447fd3e765f1978884fa2f6 |
|
BLAKE2b-256 | 169c375c19984fb9b166c629d3f3eea0ca4b770917915193327e63df8c3c8bb7 |