From b92bb10f0169fb47bad6af764886e04e767f4514 Mon Sep 17 00:00:00 2001 From: Oxore Date: Mon, 31 Jul 2023 00:22:00 +0300 Subject: Fix initial positions and remove dotted grid --- src/main.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index e5a8d04..2cf1b23 100644 --- a/src/main.rs +++ b/src/main.rs @@ -206,7 +206,7 @@ impl Default for Game { field: Field::default(), figure: Figure::kind_random(), x: 3, - y: 18, + y: 17, fall_timeout: Timeout::from_duration(std::time::Duration::from_millis(500)), place_timeout: None, } @@ -217,7 +217,7 @@ impl Game { fn place_figure(&mut self) { self.field.render(&self.figure, self.x, self.y); self.figure = Figure::kind_random(); - (self.x, self.y) = (3, 18); + (self.x, self.y) = (3, 17); self.stop_place_timeout(); for line in 0..FIELD_ROWS - 1 { while self.field.is_line_complete(line) { @@ -322,15 +322,16 @@ impl Game { fn print_field(field: &Field) { cursor_to_home(); for y in 0..FIELD_ROWS_VISIBLE { + print!("|"); for x in 0..FIELD_COLS { let c = field.cells[(FIELD_ROWS_VISIBLE - 1 - y) * FIELD_COLS + x]; if c == 0 { - print!(". "); + print!(" "); } else { print!("██"); } } - print!("\r\x1b[1B"); + print!("|\r\x1b[1B"); } } -- cgit v1.2.3