當前位置: 首頁>>代碼示例>>C#>>正文


C# Board.AddNewPiece方法代碼示例

本文整理匯總了C#中Board.AddNewPiece方法的典型用法代碼示例。如果您正苦於以下問題:C# Board.AddNewPiece方法的具體用法?C# Board.AddNewPiece怎麽用?C# Board.AddNewPiece使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Board的用法示例。


在下文中一共展示了Board.AddNewPiece方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BoardDetectsBottomLinesEvenIfNoCurrentPieceLeans

 public void BoardDetectsBottomLinesEvenIfNoCurrentPieceLeans()
 {
     var board = new Board(2, 3);
     board.AddNewPiece();
     board.AddNewBlock(1, 2);
     board.AddNewBlock(0, 2);
     //BB
     //BB
     Assert.AreEqual(2, board.GetBlocks().Count());
     board.Advance();
     Assert.AreEqual(0, board.GetBlocks().Count());
 }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:12,代碼來源:BoardTests.cs

示例2: WhenPuttingAPieceItTheCurrentPiecePlacesAtZeroHeight

 public void WhenPuttingAPieceItTheCurrentPiecePlacesAtZeroHeight()
 {
     var board = new Board();
     board.AddNewPiece();
     Assert.AreEqual(0, board.CurrentPiece.Y);
 }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:6,代碼來源:BoardTests.cs

示例3: WhenCurrentPieceReachesBottomVerifyesIfThereIsLineEvenForComplexPieces

        public void WhenCurrentPieceReachesBottomVerifyesIfThereIsLineEvenForComplexPieces()
        {
            var board = new Board(3, 5);
            var block1 = new Block(0, 0);
            var block2 = new Block(2, 0);
            board.AddNewPiece(new[] { block1, block2 });
            board.AddNewBlock(1, 4);
            // P P
            //
            //
            //
            //  X
            Assert.AreEqual(1, board.GetBlocks().Count());
            board.Advance(); //1
            board.Advance();
            board.Advance();
            board.Advance(); //4
            board.Advance();

            Assert.IsNull(board.CurrentPiece);
            Assert.AreEqual(0, board.GetBlocks().Count());
        }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:22,代碼來源:BoardTests.cs

示例4: WhenPieceReachesBottomItsBlocksBecamePartOfTheBoard

        public void WhenPieceReachesBottomItsBlocksBecamePartOfTheBoard()
        {
            var board = new Board(2, 3);
            board.AddNewPiece();
            var block = board.CurrentPiece.GetBlocks().First();

            board.Advance();
            board.Advance();
            board.Advance();//no deberia hacer linea

            Assert.IsTrue(board.Contains(block));
        }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:12,代碼來源:BoardTests.cs

示例5: WhenCurrentPieceColidesWithIsolatedBlocksEvenForComplexPieces

 public void WhenCurrentPieceColidesWithIsolatedBlocksEvenForComplexPieces()
 {
     var board = new Board(3, 3);
     var block1 = new Block(0, 0);
     var block2 = new Block(2, 0);
     board.AddNewPiece(new[] { block1, block2 });
     board.AddNewBlock(2, 2);
     board.AddNewBlock(1, 0);
     // PXP
     //
     //   X
     Assert.AreEqual(2, board.GetBlocks().Count());
     board.Advance(); //1
     Assert.AreEqual(2, board.GetBlocks().Count());
     Assert.IsNotNull(board.CurrentPiece);
     board.Advance(); //2
     Assert.IsNull(board.CurrentPiece);
     Assert.AreEqual(4, board.GetBlocks().Count());
 }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:19,代碼來源:BoardTests.cs

示例6: WhenCurrentPieceReachesBottomVerifyesIfThereIsLine

 public void WhenCurrentPieceReachesBottomVerifyesIfThereIsLine()
 {
     var board = new Board(2, 3);
     board.AddNewBlock(1, 2);
     board.AddNewPiece(); //0
     board.Advance(); //1
     board.Advance(); //2
     board.Advance(); //La pieza se apoyó.
     Assert.AreEqual(0, board.GetBlocks().Count());
 }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:10,代碼來源:BoardTests.cs

示例7: WhenBoardAdvancesCurrentPieceGoesDown

 public void WhenBoardAdvancesCurrentPieceGoesDown()
 {
     var board = new Board(30);
     board.AddNewPiece();
     for (int i = 0; i <= 20; i++)
     {
         Assert.AreEqual(i, board.CurrentPiece.Y);
         board.Advance();
     }
     Assert.AreEqual(21, board.CurrentPiece.Y);
 }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:11,代碼來源:BoardTests.cs

示例8: WhenBoardFirstAdvancesCurrentPieceGoesDown

 public void WhenBoardFirstAdvancesCurrentPieceGoesDown()
 {
     var board = new Board();
     board.AddNewPiece();
     board.Advance();
     Assert.AreEqual(1, board.CurrentPiece.Y);
 }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:7,代碼來源:BoardTests.cs

示例9: WhenAdvancesPieceBlocksAlsoAdvanceEvenForComplexPieces

 public void WhenAdvancesPieceBlocksAlsoAdvanceEvenForComplexPieces()
 {
     var board = new Board(4, 5);
     var block1 = new Block(2, 0);
     var block2 = new Block(3, 1);
     board.AddNewPiece(new[] { block1, block2 });
     board.Advance();
     Assert.AreEqual(2, block1.X);
     Assert.AreEqual(1, block1.Y);
     Assert.AreEqual(3, block2.X);
     Assert.AreEqual(2, block2.Y);
 }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:12,代碼來源:BoardTests.cs

示例10: WhenAdvancesPieceBlocksAlsoAdvance

 public void WhenAdvancesPieceBlocksAlsoAdvance()
 {
     var board = new Board();
     board.AddNewPiece();
     Assert.AreEqual(0, board.CurrentPiece.GetBlocks().First().Y);
     board.Advance();
     Assert.AreEqual(1, board.CurrentPiece.GetBlocks().First().Y);
 }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:8,代碼來源:BoardTests.cs

示例11: WhenAddingPieceCurrentPieceExists

 public void WhenAddingPieceCurrentPieceExists()
 {
     var board = new Board();
     board.AddNewPiece();
     Assert.IsNotNull(board.CurrentPiece);
 }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:6,代碼來源:BoardTests.cs

示例12: PiecesAreLeanedAlsoOnIsolatedBlocks

        public void PiecesAreLeanedAlsoOnIsolatedBlocks()
        {
            var board = new Board(2, 4);
            //
            //
            //B
            //
            var isolated = board.AddNewBlock(0, 2);
            board.AddNewPiece();
            var pieceBlock = board.CurrentPiece.GetBlocks().Single();
            board.Advance();
            board.Advance();
            Assert.AreEqual(2, board.GetBlocks().Count());
            Assert.IsTrue(board.GetBlocks().Contains(isolated));
            Assert.IsTrue(board.GetBlocks().Contains(pieceBlock));

            Assert.AreEqual(2, isolated.Y);
            Assert.AreEqual(0, isolated.X);

            Assert.AreEqual(1, pieceBlock.Y);
            Assert.AreEqual(0, pieceBlock.X);
        }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:22,代碼來源:BoardTests.cs

示例13: CurrentPieceAdvancesUntilBottom

 public void CurrentPieceAdvancesUntilBottom()
 {
     var board = new Board(3);
     board.AddNewPiece(); //0
     board.Advance(); //1
     board.Advance(); //2
     Assert.AreEqual(2, board.CurrentPiece.Y);
     board.Advance();
     Assert.IsNull(board.CurrentPiece);
 }
開發者ID:skiel85,項目名稱:randori-tetris,代碼行數:10,代碼來源:BoardTests.cs


注:本文中的Board.AddNewPiece方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。