Exemple #1
0
        private void button8_Click_1(object sender, EventArgs e)
        {
            // JPS
            JPS jps = new JPS();

            var         sw   = Stopwatch.StartNew();
            List <Node> path = jps.Search(this.tileMap, this.src, this.goal, xx1 - 1, yy2 - 1);

            sw.Stop();
            label8.Text = $"Time: {sw.Elapsed.TotalMilliseconds}ms";

            foreach (var p in path)
            {
                this.tileMap[p.X, p.Y] = 2;
                this.pathPlan.Add(new Point(p.X, p.Y));
            }
            Refresh();
        }
Exemple #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            // JPS
            JPS jps = new JPS();

            Model.Point src = new Model.Point(1, 1);

            Model.Point dest = new Model.Point(20, 1);
            this.tileMap[dest.X, dest.Y] = 0;

            List <Node> path = jps.Search(this.tileMap, src, dest, 99, 99);

            foreach (var p in path)
            {
                this.tileMap[p.X, p.Y] = 2;
                this.pathPlan.Add(new Point(p.X, p.Y));
            }
            Refresh();
        }