sh
cargo install tetris-rs
excute the binary command tetris
:
sh
tetris
Setting environment variables to customize
```toml
FEATURE_BRICK=true #bool
ACCELERATE_MODE=true #bool
WIDTH=13 #number
HEIGHT=20 #number
TEXTUREFULL='#' #char TEXTUREWALL='O' #char TEXTUREEMPTY=' ' #char TEXTURESHADOW='+' #char
```
example:
sh
TEXTURE_FULL='%' FEATURE_BRICK=false tetris
rust
pub enum BrickType {
// 7 classic bricks
I,
O,
T,
S,
Z,
L,
J,
// FEATURE_BRICK to enable feature bricks
// #
Dot,
// # #
// ###
Desk,
// #
// ##
Angle,
// #
// ##
// ##
W,
// ##
Bean,
}
Eliminating one row, you get 200
scores.
60
more points per combo.
You get 1
point for every time you accelerate.
```rust impl Record { pub fn compute(&mut self, rowsnum: usize) { if rowsnum == 0 { self.combo = 0; return; } for _ in 0..rowsnum { self.comboonce() } }
fn combo_once(&mut self) {
self.score += 200 + (self.combo * 60) as i64;
self.eliminate_rows += 1;
self.combo += 1;
// 计算历史最高连击
if self.combo > self.high_combo {
self.high_combo = self.combo
}
}
} ```
accelerate the update frequency based on your score
rust
pub fn update_by(&mut self, counter: i32) {
match self.cfg.accelerate {
true => {
let time = match self.record.score {
0..=5999 => 100,
6000..=9999 => 70,
10000..=24999 => 60,
25000..=39999 => 50,
40000..=59999 => 45,
_ => 40,
};
if counter % (time) == 0 {
self.update()
}
}
false => {
if counter % (100) == 0 {
self.update()
}
}
}
}