コード例 #1
0
        public char CellAt(int outer_row, int outer_col)
        {
            int inner_row = ToInnerRow(outer_row);
            int inner_col = ToInnerCol(outer_col);

            return(inner.CellAt(inner_row, inner_col));
        }
コード例 #2
0
        public bool isAt(int row, int col)
        {
            int inner_row = ToInnerRow(row);
            int inner_col = ToInnerCol(col);

            return(inner_row >= 0 &&
                   inner_row < tetromino.Rows() &&
                   inner_col >= 0 &&
                   inner_col < tetromino.Columns() &&
                   tetromino.CellAt(inner_row, inner_col) != Board.EMPTY);
        }
コード例 #3
0
 public bool OutsideBoard(Board board)
 {
     for (int r = 0; r < Rows(); r++)
     {
         for (int c = 0; c < Columns(); c++)
         {
             if (inner.CellAt(r, c) != Board.EMPTY)
             {
                 int outer_row = ToOuterRow(r);
                 int outer_col = ToOuterCol(c);
                 if (outer_col < 0 ||
                     outer_col >= board.Columns ||
                     outer_row < 0 ||
                     outer_row >= board.Rows)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #4
0
ファイル: MovableGrid.cs プロジェクト: gnda/E5-genie-logiciel
        public bool OutsideBoard(Board board)
        {
            bool to_return = false;

            for (int row = 0; row < Rows(); row++)
            {
                for (int col = 0; col < Columns(); col++)
                {
                    if (tetromino.CellAt(row, col) != Board.EMPTY)
                    {
                        int moverow = row + this.rows;
                        int movecol = col + this.columns;
                        if (
                            (movecol < 0) || (movecol >= board.columns) ||
                            (moverow < 0) || (moverow >= board.rows)
                            )
                        {
                            return(true);
                        }
                    }
                }
            }
            return(to_return);
        }