Skip to content

pnadon/tetris-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tetris-rs

A Tetris game implemented in Rust, inspired by a similar version written in C++. Big thanks to k-vernooy for open-sourcing his work!

Installation

MacOS

brew tap pnadon/tap
brew install tetris-rs

Linux

  • Ensure you have Rust & Cargo installed
cargo install --git https://github.com/pnadon/tetris-rs.git

Notes

At first the primary goal for this project was to take k-vernooy's Tetris game and more or less directly port it to Rust.

Shortly after I started however, I began to make drastic changes to the structure of the project so that it better fit my own coding style as well as Rust's own features. The current version of the project differs drastically from the original, with various features (and likely bugs) added.

A surprisingly big different between the Rust and C++ implementation is the difference between indexing. Since C++ uses an int for indexing, the int is allowed to be a negative value (up until it is finally used for indexing). Thus, the coordinates for a tetrimino could be negative before finally being added to an offset and used for indexing. On the other hand Rust uses a usize for indexing, which is unsigned and caused some issues in the implementation, which were finally resolved by rewriting some parts so that coordinates would always be a non-negative number.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages