예제 #1
0
 public void setPoints(int[][] points)
 {
     if (points.Length == 3)
     {
         for (int i = 0; i < points.Length; i++)
         {
             //Set point
             if (i == 0 && points[0].Length == 2)
             {
                 PointOne.setPoint(points[0][0], points[0][1]);
             }
             if (i == 1 && points[1].Length == 2)
             {
                 PointTwo.setPoint(points[1][0], points[1][1]);
             }
             if (i == 2 && points[2].Length == 2)
             {
                 PointThree.setPoint(points[2][0], points[2][1]);
             }
         }
         setSides();
         SetSortedSides();
         setAngles();
     }
 }
예제 #2
0
        public void TestMethod2List2()
        {
            //Arrange
            PointTwo <int> p = new PointTwo <int>(4);
            ListTwo <int>  l = new ListTwo <int>(p);

            //Act
            //Assert
            Assert.IsTrue(l.Length() == 1);
        }
예제 #3
0
        public void TestMethod2ListAdd3()
        {
            //Arrange
            Random         rand = new Random();
            PointTwo <int> p    = new PointTwo <int>(4);
            ListTwo <int>  l    = new ListTwo <int>(p);

            //Act
            l.Add(2, rand);
            //Assert
            Assert.IsTrue(l.Length() == 2);
        }
예제 #4
0
 public void TestIfTriangle()
 {
     Console.Write($"Triangle: ");
     PointOne.print();
     PointTwo.print();
     PointThree.print();
     Console.WriteLine();
     //Test if triangle
     if (!isTriangle())
     {
         Console.WriteLine("Not a triangle.");
         return;
     }
     //Test if right triangle
     if (isRightTriangle())
     {
         Console.WriteLine("Is a right triangle.");
     }
     //Test if acute triangle
     if (isAcute())
     {
         Console.WriteLine("Is an acute triangle.");
     }
     //Test if acute triangle
     if (isObtuse())
     {
         Console.WriteLine("Is an obtuse triangle.");
     }
     //Test if isosceles triangle
     if (isIsosceles())
     {
         Console.WriteLine("Is an isosceles triangle.");
     }
     //Test if equilateral triangle
     if (isEquilateral())
     {
         Console.WriteLine("Is an equilateral triangle.");
     }
 }
        static void Main(string[] args)
        {
            var    input = File.ReadAllLines("input.txt");
            IPoint point = new PointTwo();

            point.X = 0;
            point.Y = 2;

            //IPoint point = new Point();
            //point.X = 1;
            //point.Y = 1;
            foreach (string line in input)
            {
                for (int i = 0; i < line.Length; i++)
                {
                    switch (line[i])
                    {
                    case 'L':
                        point.MoveLeft();
                        break;

                    case 'R':
                        point.MoveRight();
                        break;

                    case 'U':
                        point.MoveUp();
                        break;

                    case 'D':
                        point.MoveDown();
                        break;
                    }
                }
                point.PrintPosition();
                //Console.WriteLine($" {point.Y}");
            }
        }