Example #1
0
        public void checkHorizontalWinTest()
        {
            PenteController pc = new PenteController(9, 9, "TESTER1", "TESTER2");

            pc.isTesting = true;

            for (int row = 0; row < 9; row++)
            {     //start of first loo0p
                for (int col = 0; col < 9; col++)
                { //start of second loop
                    PenteCellectaCanvas canvas = new PenteCellectaCanvas(row, col, pc, 10, 10);
                }//end of second loop
            }//end of first loop

            //Place 5 Pieces in a Row to see if check win method equals 5
            //Horizontally
            pc.PlaceFirstPiece();      //black
            pc.AttemptPlacement(0, 7); //white
            pc.AttemptPlacement(0, 1); //black
            pc.AttemptPlacement(1, 7); //white
            pc.AttemptPlacement(0, 2); //black
            pc.AttemptPlacement(2, 7); //white
            pc.AttemptPlacement(0, 3); //black
            pc.AttemptPlacement(3, 7); //white
            pc.AttemptPlacement(8, 1); //black
            pc.AttemptPlacement(4, 7); //white
            Assert.AreEqual(5, pc.CheckWin(3, 7, true), "Vertical Win Does Not Work");
            Assert.AreEqual(5, pc.CheckWin(0, 7, true), "Vertical Win Does Not Work");
            Assert.AreEqual(5, pc.CheckWin(1, 7, true), "Vertical Win Does Not Work");
            Assert.AreEqual(5, pc.CheckWin(2, 7, true), "Vertical Win Does Not Work");
            Assert.AreEqual(5, pc.CheckWin(4, 7, true), "Vertical Win Does Not Work");
        }
Example #2
0
        public void checkDiagonalWinTest()
        {
            PenteController pc = new PenteController(9, 9, "tester1", "tester2");

            pc.isTesting = true;

            for (int row = 0; row < 9; row++)
            {
                for (int col = 0; col < 9; col++)
                {
                    PenteCellectaCanvas canvas = new PenteCellectaCanvas(row, col, pc, 10, 10);
                }
            }
            //Place 5 Pieces in a Row to see if check win method equals 5
            //Diagonal

            pc.PlaceFirstPiece();      //black
            pc.AttemptPlacement(7, 4); //white
            pc.AttemptPlacement(1, 1); //black
            pc.AttemptPlacement(6, 5); //white
            pc.AttemptPlacement(8, 0); //black
            pc.AttemptPlacement(5, 6); //white
            pc.AttemptPlacement(4, 0); //black
            pc.AttemptPlacement(4, 7); //white
            pc.AttemptPlacement(0, 4); //black
            pc.AttemptPlacement(3, 8); //white

            Assert.AreEqual(5, pc.CheckWin(7, 4, true), $"Diagonal Win Does Not Work, Highest Count Is: {pc.CheckWin(0, 1, true)}");
            Assert.AreEqual(5, pc.CheckWin(3, 8, true), $"Diagonal Win Does Not Work, Highest Count Is: {pc.CheckWin(3, 8, true)}");
        }
Example #3
0
        public void checkVerticalWinTest()
        {
            PenteController pc = new PenteController(9, 9, "TESTER1", "TESTER2");

            pc.isTesting = true;

            for (int row = 0; row < 9; row++)
            {
                for (int col = 0; col < 9; col++)
                {
                    PenteCellectaCanvas canvas = new PenteCellectaCanvas(row, col, pc, 10, 10);
                }
            }
            //Place 5 Pieces in a Row to see if check win method equals 5
            //Vertically
            pc.PlaceFirstPiece();      //black
            pc.AttemptPlacement(7, 0); //white
            pc.AttemptPlacement(0, 1); //black
            pc.AttemptPlacement(7, 1); //white
            pc.AttemptPlacement(0, 2); //black
            pc.AttemptPlacement(7, 2); //white
            pc.AttemptPlacement(0, 3); //black
            pc.AttemptPlacement(7, 3); //white
            pc.AttemptPlacement(8, 1); //black
            pc.AttemptPlacement(7, 4); //white
            Assert.AreEqual(5, pc.CheckWin(7, 0, true), "Horizontal Win Does Not Work");
            Assert.AreEqual(5, pc.CheckWin(7, 1, true), "Horizontal Win Does Not Work");
            Assert.AreEqual(5, pc.CheckWin(7, 2, true), "Horizontal Win Does Not Work");
            Assert.AreEqual(5, pc.CheckWin(7, 3, true), "Horizontal Win Does Not Work");
            Assert.AreEqual(5, pc.CheckWin(7, 4, true), "Horizontal Win Does Not Work");
        }
Example #4
0
        public void TesseraTest()
        {
            PenteController pc = new PenteController(9, 9, "Boris", "Kyle");

            pc.isTesting = true;

            for (int row = 0; row < 9; row++)
            {
                for (int col = 0; col < 9; col++)
                {
                    PenteCellectaCanvas canvas = new PenteCellectaCanvas(row, col, pc, 10, 10);
                }
            }
            pc.PlaceFirstPiece();      //black
            pc.AttemptPlacement(0, 7); //white
            pc.AttemptPlacement(0, 1); //black
            pc.AttemptPlacement(1, 7); //white
            pc.AttemptPlacement(0, 2); //black
            pc.AttemptPlacement(2, 7); //white
            pc.AttemptPlacement(0, 3); //black
            pc.AttemptPlacement(3, 7); //white

            pc.CheckWin(0, 7, true);
            pc.Yell(true, 4);
            Assert.AreEqual(true, pc.isTessera, $"Tria Yell Does Not Work its {pc.isTessera} ");
        }