コード例 #1
0
 private MovableGrid(int outer_row, int outer_col, Tetromino inner, Board board)
 {
     this.inner = inner;
     this.board = board;
     this.row   = outer_row;
     this.col   = outer_col;
 }
コード例 #2
0
        public void Drop(Tetromino shape)
        {
            checkIfAlreadyFalling();
            int row = StartingRowOffset(shape);

            fallingBlock = new MovableGrid(shape).MoveTo(row, Cols / 2 - shape.Columns() / 2);
        }
コード例 #3
0
        public void Drop(Tetromino shape)
        {
            CheckIsFalling();
            int r = StartingRowOffset(shape);

            fallingBlock = new MovableGrid(shape).MoveTo(r, Columns / 2 - shape.Columns() / 2);
        }
コード例 #4
0
        public void Drop(Tetromino tetromino)
        {
            CheckIfFalling();
            int         row = StartingRowOffset(tetromino);
            MovableGrid mg  = new MovableGrid(tetromino);

            this.fallingBlock = mg.MoveTo(row, (this.columns / 2) - (tetromino.Columns() / 2));
        }
コード例 #5
0
        public static Tetromino CreateOshape()
        {
            Tetromino t
                = new Tetromino(
                      ".OO.\n" +
                      ".OO.\n"
                      );

            return(t);
        }
コード例 #6
0
ファイル: Tetromino.cs プロジェクト: sofianeoudina/TP3_Tetris
 public Tetromino(Tetromino t)
 {
     rotations = new Piece[t.length];
     for (int i = 0; i < t.length; i++)
     {
         rotations[i] = t.rotations[i];
     }
     index_rotation = t.index_rotation;
     length         = t.length;
 }
コード例 #7
0
ファイル: Tetromino.cs プロジェクト: sofianeoudina/TP3_Tetris
        public Tetromino RotateLeft()
        {
            Tetromino newTetromino = new Tetromino(this);

            newTetromino.index_rotation--;
            if (newTetromino.index_rotation < 0)
            {
                newTetromino.index_rotation = length - 1;
            }

            return(newTetromino);
        }
コード例 #8
0
ファイル: Tetromino.cs プロジェクト: sofianeoudina/TP3_Tetris
        public Tetromino RotateRight()
        {
            Tetromino newTetromino = new Tetromino(this);

            newTetromino.index_rotation++;
            if (newTetromino.index_rotation == length)
            {
                newTetromino.index_rotation = 0;
            }

            return(newTetromino);
        }
コード例 #9
0
ファイル: Block.cs プロジェクト: gnda/E5-genie-logiciel
 public Block(Tetromino grid)
 {
     this.rows    = grid.Rows();
     this.columns = grid.Columns();
     this.block   = new char[this.rows, this.columns];
     for (int row = 0; row < this.rows; row++)
     {
         for (int col = 0; col < this.columns; col++)
         {
             this.block[row, col] = grid.cellule(row, col);
         }
     }
 }
コード例 #10
0
        public static Tetromino CreateZshape()
        {
            Tetromino t
                = new Tetromino(
                      "....\n" +
                      "ZZ..\n" +
                      ".ZZ.\n"
                      ,
                      "..Z.\n" +
                      ".ZZ.\n" +
                      ".Z..\n"
                      );

            return(t);
        }
コード例 #11
0
        public static Tetromino CreateSshape()
        {
            Tetromino s =
                new Tetromino(
                    "....\n" +
                    ".SS.\n" +
                    "SS..\n"
                    ,
                    "S...\n" +
                    "SS..\n" +
                    ".S..\n"
                    );

            return(s);
        }
コード例 #12
0
        public static Tetromino CreateIshape()
        {
            Tetromino t
                = new Tetromino(
                      "....\n" +
                      "IIII\n" +
                      "....\n" +
                      "....\n"
                      ,
                      "..I.\n" +
                      "..I.\n" +
                      "..I.\n" +
                      "..I.\n"
                      );

            return(t);
        }
コード例 #13
0
        public static Tetromino CreateLshape()
        {
            Tetromino t
                = new Tetromino(
                      "....\n" +
                      "LLL.\n" +
                      "L...\n"
                      ,
                      "LL..\n" +
                      ".L..\n" +
                      ".L..\n"
                      ,
                      "....\n" +
                      "..L.\n" +
                      "LLL.\n"
                      ,
                      ".L..\n" +
                      ".L..\n" +
                      ".LL.\n"
                      );

            return(t);
        }
コード例 #14
0
        public static Tetromino CreateJshape()
        {
            Tetromino t
                = new Tetromino(
                      "....\n" +
                      "JJJ.\n" +
                      "..J.\n"
                      ,
                      ".J..\n" +
                      ".J..\n" +
                      "JJ..\n"
                      ,
                      "....\n" +
                      "J...\n" +
                      "JJJ.\n"
                      ,
                      ".JJ.\n" +
                      ".J..\n" +
                      ".J..\n"
                      );

            return(t);
        }
コード例 #15
0
 public MovableGrid(Tetromino inner, Board board) : this(0, 0, inner, board)
 {
 }
コード例 #16
0
ファイル: MovableGrid.cs プロジェクト: gnda/E5-genie-logiciel
 private MovableGrid(int moverow, int movecol, Tetromino tetromino)
 {
     this.rows      = moverow;
     this.columns   = movecol;
     this.tetromino = tetromino;
 }
コード例 #17
0
ファイル: MovableGrid.cs プロジェクト: gnda/E5-genie-logiciel
 public MovableGrid(Tetromino tetromino) : this(0, 0, tetromino)
 {
 }
コード例 #18
0
 public MovableGrid(Tetromino tetromino)
 {
     this.Row       = 0;
     this.Col       = 0;
     this.tetromino = tetromino;
 }
コード例 #19
0
 public MovableGrid(Tetromino inner) : this(0, 0, inner)
 {
 }
コード例 #20
0
 private MovableGrid(Tetromino tetromino, int row, int col)
 {
     this.Row       = row;
     this.Col       = col;
     this.tetromino = tetromino;
 }
コード例 #21
0
 public MovableGrid(Tetromino tetromino)
 {
     Representation = tetromino;
 }
コード例 #22
0
 private MovableGrid(int outer_row, int outer_col, Tetromino inner)
 {
     this.row   = outer_row;
     this.col   = outer_col;
     this.inner = inner;
 }
コード例 #23
0
 public MovableGrid(Tetromino tetromino, int x, int y)
 {
     Representation = tetromino;
     X = x;
     Y = y;
 }