Jump to content
  • Advertisement

Aisu Uizaado

Member
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

103 Neutral

About Aisu Uizaado

  • Rank
    Newbie
  1. Aisu Uizaado

    Scouting smartly?

    /Update: wrote a simple recursive search, it's kinda fcking slow =d class rs_data { public List<ExplorerPoint> bestpath = null; public float bestpath_hdist = float.MaxValue; } private float recursive_search(float traveleddist, Vector3D lastpoint, List<ExplorerPoint> xplist, rs_data rs_data, int deep=0, List<ExplorerPoint> chain=null) { if (rs_data.bestpath_hdist < traveleddist) return traveleddist; if (chain == null) chain = new List<ExplorerPoint>(); if (xplist.Count == 0) { if (traveleddist < rs_data.bestpath_hdist) { rs_data.bestpath_hdist = traveleddist; rs_data.bestpath = chain.ToList(); //backtrack last ? } return traveleddist; } var newlist = xplist.OrderBy( w => { return heuristicDistance((float)lastpoint.X, (float)lastpoint.Y, (float)w.Pos.X, (float)w.Pos.Y); }); ExplorerPoint bestnode = null; float bestnode_dist = float.MaxValue; var i = 1; if (deep < 10) i = 2; foreach (var xp1 in newlist) { i--; if (i == -1) break; var hdist = (float)Math.Sqrt(heuristicDistance((float)xp1.Pos.X, (float)xp1.Pos.Y, (float)lastpoint.X, (float)lastpoint.Y)); if ((traveleddist + hdist) > rs_data.bestpath_hdist) continue; var n = newlist.ToList(); n.Remove(xp1); chain.Add(xp1); var res = recursive_search(traveleddist + hdist, xp1.Pos, n, rs_data, deep + 1, chain); chain.RemoveAt(chain.Count - 1); if (res < bestnode_dist) { bestnode = xp1; bestnode_dist = res; } } return bestnode_dist; }
  2. Aisu Uizaado

    Scouting smartly?

    Update: thanks for all the no-reply, after some reading it seems that this is traveling salesman problem...
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!