Exemple #1
0
        public void ClearV2()
        {
            TestBoard board = new TestBoard();

            for (int i = 0; i < 10; i++)
            {
                board[19, i] = Color.Transparent;
                board[18, i] = Color.Transparent;
                board[15, i] = Color.Transparent;
                board[13, i] = Color.Transparent;
                if (i % 2 == 0)
                {
                    board[17, i] = Color.Transparent;
                    board[14, i] = Color.Transparent;
                }
                else
                {
                    board[16, i] = Color.Transparent;
                    board[12, i] = Color.Transparent;
                }
            }

            TestBoard afterBoard = new TestBoard();

            for (int i = 0; i < 10; i++)
            {
                if (i % 2 == 0)
                {
                    afterBoard[19, i] = Color.Transparent;
                    afterBoard[17, i] = Color.Transparent;
                }
                else
                {
                    afterBoard[16, i] = Color.Transparent;
                    afterBoard[18, i] = Color.Transparent;
                }
            }



            board.lineCheck();

            var same = true;

            for (int x = 0; x < 20; x++)
            {
                for (int y = 0; y < 10; y++)
                {
                    if (board[x, y] != afterBoard[x, y])
                    {
                        same = false;
                    }
                }
            }

            Console.WriteLine();
            Assert.AreEqual(true, same);
        }
Exemple #2
0
        public void LineCheck()
        {
            TestBoard board = new TestBoard();

            int lines = 4;

            for (int i = 0; i < lines; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    board[i + 2, j] = Color.Blue;
                }
            }

            int clearedLines = board.lineCheck();

            Console.WriteLine();
            Assert.AreEqual(clearedLines, lines);
        }