Exemple #1
0
        public void TestSolveHardUnknot1()
        {
            Knot knot = new Knot(new List <int>()
            {
                4, -1, 2, 5, 8, -9, 10, -7, 6, -3, 1, -2, 3, -4, -5, -6, 7, -8, 9, -10
            });

            knot = Knot.Solve(knot);
            Assert.IsTrue(knot.IsUnknot);
        }
        private void KnotCanvas_Load(object sender, EventArgs e)
        {
            drawArea        = new Bitmap(canvas_pic.Size.Width, canvas_pic.Size.Height);
            g               = Graphics.FromImage(drawArea);
            g.SmoothingMode = SmoothingMode.AntiAlias;

            //TEST
            //Knot knot = new Knot(new List<int>() { 4, -1, 2, 5, 8, -9, 10, -7, 6, -3, 1, -2, 3, -4, -5, -6, 7, -8, 9, -10 });
            //Knot knot = new Knot(new List<int>() { -1, 2, -3, 1, -2, 3, -4, 5, -6, 7, 8, 4, -5, 6, -7, -8 });
            //Knot knot = new Knot(new List<int>() { -1, 2, -3, 1, -2, 3, -4, 5, -6, 4, -5, 6, -7, 8, -9, 10, -8, 7, -10, 9 });
            //Knot knot = new Knot(new List<int>() { 1, -2, 3, 4, 5, 6, -6, -5, -4, -1, 2, -3 });
            Knot knot = new Knot(new List <int>()
            {
                1, -2, 3, 4, 5, -6, 7, -8, 9, -10, 2, -3, 10, -1, -4, -9, 8, -5, 6, -7
            });

            knot = Knot.Solve(knot);
            //int[] factors = Knot.Factorize(knot);
        }
Exemple #3
0
        public void TestSolveHardKnot1()
        {
            Knot knot = new Knot(new List <int>()
            {
                -1, 2, -3, 1, -2, 3, -4, 5, -6, 7, 8, 4, -5, 6, -7, -8
            });
            Knot solved = new Knot(new List <int>()
            {
                -1, 2, -3, 1, -2, 3, -4, 5, -6, 4, -5, 6
            });

            knot = Knot.Solve(knot);
            Assert.AreEqual(solved, knot);
        }
Exemple #4
0
        public void TestSolve2OK()
        {
            //Figure eight with an extra twist
            Knot knot = new Knot(new List <int>()
            {
                1, -2, 3, 4, 5, 6, -6, -5, -4, -1, 2, -3
            });
            Knot solved = new Knot(new List <int>()
            {
                1, -2, 3, -1, 2, -3
            });

            knot = Knot.Solve(knot);
            Assert.AreEqual(solved, knot);
        }