asmrobot
2019-10-29 f25f89101a98ad815c0ae2d25e1a8dc35d53a5dd
src/test/Program.cs
@@ -4,63 +4,77 @@
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using RichCreator.Utility.Structs;
using RichCreator.Utility;
using System.Drawing;
using RichCreator.Utility.Captures;
using static test.Graphics;
using RichCreator.Utility.PathFinding;
namespace test
{
    public class person
    public struct person
    {
        public int age { get; set; }
        public string name { get; set; }
    }
    class Program
    {
        static void GetN(person p)
        {
            p = new person();
            p.age = 2;
        }
        //static void GetN(person p)
        //{
        //    p = new person();
        //    p.age = 2;
        //}
        static void Main(string[] args)
        {
            ZTPoint A = new ZTPoint(0, 1);
            ZTPoint B = new ZTPoint(1, 0);
            ZTPoint C = new ZTPoint(3, 0);
            ZTPoint D = new ZTPoint(4, 1);
            ZTPoint E = new ZTPoint(3, 2);
            ZTPoint F = new ZTPoint(2, 1);
            ZTPoint G = new ZTPoint(1, 2);
            var edges = new List<Tuple<ZTPoint, ZTPoint, double>>()
            {
                new Tuple<ZTPoint,ZTPoint,double>(A,B,12),
                new Tuple<ZTPoint,ZTPoint,double>(A,F,16),
                new Tuple<ZTPoint,ZTPoint,double>(A,G,14),
                new Tuple<ZTPoint,ZTPoint,double>(B,F,7),
                new Tuple<ZTPoint,ZTPoint,double>(B,C,10),
                new Tuple<ZTPoint,ZTPoint,double>(G,F,9),
                new Tuple<ZTPoint,ZTPoint,double>(G,E,8),
                new Tuple<ZTPoint,ZTPoint,double>(F,C,6),
                new Tuple<ZTPoint,ZTPoint,double>(F,E,2),
                new Tuple<ZTPoint,ZTPoint,double>(C,D,3),
                new Tuple<ZTPoint,ZTPoint,double>(C,E,5),
                new Tuple<ZTPoint,ZTPoint,double>(E,D,4),
            };
            person p = new person();
            p.age = 12;
            p.name = "xylee";
            var dij = new Dijkstra(edges);
            var path = dij.Find(D, G);
            for (int i = 0; i < path.Count; i++)
            {
                Console.WriteLine(path[i].ToString());
            }
            Console.WriteLine(ZTImage.Json.JsonBuilder.ToJsonString(p));
            //ZTPoint A = new ZTPoint(0, 1);
            //ZTPoint B = new ZTPoint(1, 0);
            //ZTPoint C = new ZTPoint(3, 0);
            //ZTPoint D = new ZTPoint(4, 1);
            //ZTPoint E = new ZTPoint(3, 2);
            //ZTPoint F = new ZTPoint(2, 1);
            //ZTPoint G = new ZTPoint(1, 2);
            //var edges = new List<Tuple<ZTPoint, ZTPoint, double>>()
            //{
            //    new Tuple<ZTPoint,ZTPoint,double>(A,B,12),
            //    new Tuple<ZTPoint,ZTPoint,double>(A,F,16),
            //    new Tuple<ZTPoint,ZTPoint,double>(A,G,14),
            //    new Tuple<ZTPoint,ZTPoint,double>(B,F,7),
            //    new Tuple<ZTPoint,ZTPoint,double>(B,C,10),
            //    new Tuple<ZTPoint,ZTPoint,double>(G,F,9),
            //    new Tuple<ZTPoint,ZTPoint,double>(G,E,8),
            //    new Tuple<ZTPoint,ZTPoint,double>(F,C,6),
            //    new Tuple<ZTPoint,ZTPoint,double>(F,E,2),
            //    new Tuple<ZTPoint,ZTPoint,double>(C,D,3),
            //    new Tuple<ZTPoint,ZTPoint,double>(C,E,5),
            //    new Tuple<ZTPoint,ZTPoint,double>(E,D,4),
            //};
            //var dij = new Dijkstra(edges);
            //var path = dij.Find(D, G);
            //for (int i = 0; i < path.Count; i++)
            //{
            //    Console.WriteLine(path[i].ToString());
            //}
            Console.WriteLine("finish!~");