change spawn location of O tetrimino

This commit is contained in:
4a656666 2022-03-30 10:29:48 -05:00
parent 37cf304a56
commit d538bcc6d6
2 changed files with 19 additions and 20 deletions

View file

@ -1,5 +1,3 @@
use crate::Rotation;
pub type TetriminoData = &'static [&'static [bool]];
// these particular letter choices make it easier to see the shape of the tetrimino
@ -38,20 +36,20 @@ pub const I: [TetriminoData; 4] = [
pub const O: [TetriminoData; 4] = [
&[
&[U, U],
&[U, U],
&[o, U, U],
&[o, U, U],
],
&[
&[U, U],
&[U, U],
&[o, U, U],
&[o, U, U],
],
&[
&[U, U],
&[U, U],
&[o, U, U],
&[o, U, U],
],
&[
&[U, U],
&[U, U],
&[o, U, U],
&[o, U, U],
],
];
@ -170,6 +168,16 @@ pub const L: [TetriminoData; 4] = [
],
];
#[derive(Debug, Clone, Copy)]
#[repr(u8)]
pub enum Rotation {
Spawn,
Clockwise,
Flipped,
CounterClockwise
}
#[derive(Debug, Clone, Copy)]
pub struct WallkickTable([[(i32, i32); 5]; 8]);

View file

@ -1,5 +1,5 @@
use std::{collections::VecDeque, time::{Instant, Duration}};
use data::{TetriminoData, WallkickTable, WALLKICK_TABLE_1, WALLKICK_TABLE_2};
use data::{TetriminoData, WallkickTable, WALLKICK_TABLE_1, WALLKICK_TABLE_2, Rotation};
use pancurses::{initscr, noecho, Input, endwin, start_color, init_color, use_default_colors, init_pair, COLOR_RED, COLOR_CYAN, COLOR_YELLOW, COLOR_MAGENTA, COLOR_GREEN, COLOR_BLUE, Window, COLOR_WHITE, curs_set, cbreak};
use rand::prelude::*;
@ -37,15 +37,6 @@ enum TetriminoKind {
I, O, T, S, Z, J, L
}
#[derive(Debug, Clone, Copy)]
#[repr(u8)]
enum Rotation {
Spawn,
Clockwise,
Flipped,
CounterClockwise
}
#[derive(Debug, Clone, Copy)]
struct Tetrimino {
kind: TetriminoKind,