<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Game Algorithms</title><link>http://forums.xna.com/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>Re: Problem with A*(ish) path finding</title><link>http://forums.xna.com/forums/thread/50180.aspx</link><pubDate>Thu, 06 Mar 2008 08:53:33 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:50180</guid><dc:creator>Scrogu</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/50180.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=45&amp;PostID=50180</wfw:commentRss><description>You can declare and pass 'struct'ures instead of classes.&amp;nbsp; Structures are passed by value (unless you specify 'ref').&lt;br&gt;</description></item><item><title>Re: Problem with A*(ish) path finding</title><link>http://forums.xna.com/forums/thread/50177.aspx</link><pubDate>Thu, 06 Mar 2008 08:24:06 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:50177</guid><dc:creator>Rinse</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/50177.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=45&amp;PostID=50177</wfw:commentRss><description>&lt;P&gt;Yeh in most (all?)&amp;nbsp;OO languages, objects are passed by reference.&lt;/P&gt;
&lt;P&gt;I think you've just got to make a copy of the object. By making a &lt;A href="http://msdn2.microsoft.com/en-us/library/ms173116(VS.80).aspx"&gt;copy constructor&lt;/A&gt; 'public Thing(Thing t)' , &lt;A href="http://www.codeproject.com/KB/cs/cloneimpl_class.aspx"&gt;or implementing ICloneable and creating a Clone method&lt;/A&gt;. If I coded more I could be more thorough.&lt;/P&gt;</description></item><item><title>Re: Problem with A*(ish) path finding</title><link>http://forums.xna.com/forums/thread/50165.aspx</link><pubDate>Thu, 06 Mar 2008 04:55:46 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:50165</guid><dc:creator>Austin K</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/50165.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=45&amp;PostID=50165</wfw:commentRss><description>&lt;P&gt;The idea light bulb is: [i ] , but without the space. Silly Live messenger icons!&lt;/P&gt;
&lt;P&gt;Anyway, someone pointed out what the problem is with it- I didn't know that if you passed a class to a function, and change values inside this class&amp;nbsp;within the function it updates the original class you passed it too... I knew PHP did that,&amp;nbsp;but I didn't realise C# did.&lt;/P&gt;
&lt;P&gt;Is there an easy way to stop this happening?&lt;/P&gt;</description></item><item><title>Re: Problem with A*(ish) path finding</title><link>http://forums.xna.com/forums/thread/50138.aspx</link><pubDate>Wed, 05 Mar 2008 22:27:38 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:50138</guid><dc:creator>Michael Spencer</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/50138.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=45&amp;PostID=50138</wfw:commentRss><description>I studied graph search algorithms in class, and I KNOW I can help you find your problem -- but the forum resists my attempts to read your code or to copy it and paste it into a text editor.&amp;nbsp; There are idea light bulb icons where some code should be.&amp;nbsp; Could you post your code in another format (perhaps with pre tags) or post it on a web site and link it?</description></item><item><title>Problem with passing classes to functions (A*ish path finding)</title><link>http://forums.xna.com/forums/thread/50096.aspx</link><pubDate>Wed, 05 Mar 2008 17:53:53 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:50096</guid><dc:creator>Austin K</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/50096.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=45&amp;PostID=50096</wfw:commentRss><description>&lt;P&gt;&lt;FONT style="BACKGROUND-COLOR:#ff0000;"&gt;Update is in the third post, the problem is nothing to do with A* stuff! :$&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Hey,&lt;BR&gt;&lt;BR&gt;I've created a basic program to implement the A* path finding algorithm, and am having a few problems with understanding what's actually wrong with my program. Before I start, I've done it differently so that the path isn't really the shortest path, but the one that keeps the path as close to the line between the start point and the target point as possible... it wasn't deliberate at first but I just left it in when I realised my mistake because it's fairly cool.&lt;BR&gt;&lt;BR&gt;Anyway, my problem is this. When I call the routine to find a path the first time, it works... fine. The second time I call it, it just hangs... and I have absolutely no idea why. I've gone through my code many times trying to find something that is left behind from the first time the function is called but to no avail. Hell, I've made the entire class reset to empty before it trys to recaculate the path, but it still hangs?!?&lt;BR&gt;&lt;BR&gt;I've a class called 'tile', and a 2 dimensional array of these to form the 'grid' in the function, or 'tiles' in the update code. These tiles can either be blocked or not blocked, and if they are then the path finder should avoid these tiles.&lt;BR&gt;&lt;BR&gt;&amp;nbsp;Any help at all would be greatly appreciated... I've never been taught any of this so I've had to figure it out!&lt;BR&gt;&lt;/P&gt;
&lt;DIV style="BACKGROUND-COLOR:white;"&gt;
&lt;DIV style="PADDING-RIGHT:2px;OVERFLOW-Y:hidden;PADDING-LEFT:8px;OVERFLOW-X:scroll;PADDING-BOTTOM:2px;MARGIN:0px;WIDTH:505px;PADDING-TOP:2px;BACKGROUND-COLOR:white;"&gt;&lt;PRE&gt;&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:black;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; Vector2[] path &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; Vector2[10000];&lt;BR&gt;        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt; pathlength;   &lt;BR&gt;&lt;BR&gt;  &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;void&lt;/SPAN&gt; updatepath(Tile[,] grid, Vector2 startposition, Vector2 target)&lt;BR&gt;        {&lt;BR&gt;                     &lt;BR&gt;        Vector2[] searchedlist &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; Vector2[1000];&lt;BR&gt;        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt; searchedlistnumber &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; 0;&lt;BR&gt;&lt;BR&gt;            &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt; currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; (&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)startposition.X;&lt;BR&gt;            &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt; currenty &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; (&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)startposition.Y;&lt;BR&gt;            searchedlistnumber &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; 0;&lt;BR&gt;            &lt;BR&gt;            pathlength &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; 0;&lt;BR&gt;            path &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; Vector2[10000];&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;        restart:&lt;BR&gt;&lt;BR&gt;            grid[currentx, currenty].closed &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;true&lt;/SPAN&gt;;&lt;BR&gt;&lt;BR&gt;            &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1 &amp;gt;= 0)&lt;BR&gt;            {&lt;BR&gt;                &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (grid[currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty].isblocked == &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;false&lt;/SPAN&gt; &amp;amp;&amp;amp; grid[currentx-1, currenty].closed == &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;false&lt;/SPAN&gt;)&lt;BR&gt;                {&lt;BR&gt;&lt;BR&gt;                    &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;float&lt;/SPAN&gt; pathg &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; 20 &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;*&lt;/SPAN&gt; Math.Abs(startposition.X &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;+&lt;/SPAN&gt; 1) &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;+&lt;/SPAN&gt; 20 &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;*&lt;/SPAN&gt; Math.Abs(startposition.Y &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; currenty);&lt;BR&gt;&lt;BR&gt;                    &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (grid[currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty].pathF == 0)&lt;BR&gt;                    {&lt;BR&gt;                        searchedlist[searchedlistnumber] &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; Vector2(currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty);&lt;BR&gt;                        searchedlistnumber += 1;&lt;BR&gt;                    }&lt;BR&gt;&lt;BR&gt;                    &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (pathg &amp;lt; grid[currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty].pathG || grid[currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty].pathG == 0)&lt;BR&gt;                    {&lt;BR&gt;                        grid[currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty].pathG &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; pathg;&lt;BR&gt;                        grid[currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty].parenttile &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; Vector2(currentx, currenty);&lt;BR&gt;                    }&lt;BR&gt;&lt;BR&gt;                    grid[currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty].pathH &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; 20 &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;*&lt;/SPAN&gt; Math.Abs(target.X &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;+&lt;/SPAN&gt; 1) &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;+&lt;/SPAN&gt; 20 &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;*&lt;/SPAN&gt; Math.Abs(target.Y &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; currenty);&lt;BR&gt;                    grid[currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty].pathF &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; grid[currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty].pathH &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;+&lt;/SPAN&gt; grid[currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 1, currenty].pathG;&lt;BR&gt;                }&lt;BR&gt;            }&lt;BR&gt;&lt;BR&gt;          [does the same &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;as&lt;/SPAN&gt; above but &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;for&lt;/SPAN&gt; one box to the left, one box to the top and one to the bottom &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;in&lt;/SPAN&gt; here... pretty much the same code so I've left it &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;out&lt;/SPAN&gt;...]&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;#region Find Minimum F value that's on an open grid box&lt;BR&gt;&lt;BR&gt;            &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;float&lt;/SPAN&gt; minimumpathF &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; 0;&lt;BR&gt;            Vector2 minimumvector &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; Vector2.Zero;&lt;BR&gt;&lt;BR&gt;            &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;for&lt;/SPAN&gt; (&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt; i &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; 0; i &amp;lt; searchedlistnumber; i++)&lt;BR&gt;            {&lt;BR&gt;                &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (grid[(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)searchedlist&lt;img src="http://forums.xna.com/emoticons/emotion-55.gif" alt="Idea" /&gt;.X, (&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)searchedlist&lt;img src="http://forums.xna.com/emoticons/emotion-55.gif" alt="Idea" /&gt;.Y].pathF &amp;lt; minimumpathF || minimumpathF == 0)&lt;BR&gt;                {&lt;BR&gt;                    &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (grid[(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)searchedlist&lt;img src="http://forums.xna.com/emoticons/emotion-55.gif" alt="Idea" /&gt;.X, (&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)searchedlist&lt;img src="http://forums.xna.com/emoticons/emotion-55.gif" alt="Idea" /&gt;.Y].closed == &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;false&lt;/SPAN&gt;)&lt;BR&gt;                    {&lt;BR&gt;                        minimumpathF &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; grid[(&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)searchedlist&lt;img src="http://forums.xna.com/emoticons/emotion-55.gif" alt="Idea" /&gt;.X, (&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)searchedlist&lt;img src="http://forums.xna.com/emoticons/emotion-55.gif" alt="Idea" /&gt;.Y].pathF;&lt;BR&gt;                        minimumvector &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; Vector2(searchedlist&lt;img src="http://forums.xna.com/emoticons/emotion-55.gif" alt="Idea" /&gt;.X, searchedlist&lt;img src="http://forums.xna.com/emoticons/emotion-55.gif" alt="Idea" /&gt;.Y);&lt;BR&gt;                    }&lt;BR&gt;                }&lt;BR&gt;            }&lt;BR&gt;#endregion&lt;BR&gt;&lt;BR&gt;#region Move to smallest value F slot, if that's the target square then backtrack the parents of the tiles and add them to the total path&lt;BR&gt;            currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; (&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)minimumvector.X;&lt;BR&gt;            currenty &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; (&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)minimumvector.Y;&lt;BR&gt;&lt;BR&gt;            &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (currentx == target.X &amp;amp;&amp;amp; currenty == target.Y)&lt;BR&gt;            {&lt;BR&gt;                &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt; aa &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; 0;&lt;BR&gt;                &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;bool&lt;/SPAN&gt; atstart &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;false&lt;/SPAN&gt;;&lt;BR&gt;                &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;while&lt;/SPAN&gt; (atstart == &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;false&lt;/SPAN&gt;)&lt;BR&gt;                {&lt;BR&gt;                    path[aa] &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; grid[currentx, currenty].parenttile;&lt;BR&gt;                    currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; (&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)path[aa].X;&lt;BR&gt;                    currenty &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; (&lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt;)path[aa].Y;&lt;BR&gt;                    &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (path[aa] == startposition)&lt;BR&gt;                    {&lt;BR&gt;                        atstart &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;true&lt;/SPAN&gt;;&lt;BR&gt;                        pathlength &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; aa;&lt;BR&gt;                    }&lt;BR&gt;                    aa += 1;&lt;BR&gt;                }&lt;BR&gt;            }&lt;BR&gt;            &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;else&lt;/SPAN&gt;&lt;BR&gt;            {&lt;BR&gt;                &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;goto&lt;/SPAN&gt; restart;&lt;BR&gt;            }&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;        }&lt;BR&gt;#endregion&lt;BR&gt;    }&lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;override&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;void&lt;/SPAN&gt; Update(GameTime gameTime)&lt;BR&gt;        {&lt;BR&gt;            mouseState &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; Mouse.GetState();&lt;BR&gt;&lt;BR&gt;     &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (mouseState.LeftButton == ButtonState.Pressed)&lt;BR&gt;            {&lt;BR&gt;&lt;BR&gt;                &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (mouseState.X &amp;gt; 100 &amp;amp;&amp;amp; mouseState.X &amp;lt; 700)&lt;BR&gt;                {&lt;BR&gt;                    &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (mouseState.Y &amp;gt; 100 &amp;amp;&amp;amp; mouseState.Y &amp;lt; 500)&lt;BR&gt;                    {&lt;BR&gt;                        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt; currentx &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; ((mouseState.X &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 100) &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; (mouseState.X &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 100) &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;%&lt;/SPAN&gt; 20) &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;/&lt;/SPAN&gt; 20;&lt;BR&gt;                        &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;int&lt;/SPAN&gt; currenty &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; ((mouseState.Y &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 100) &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; (mouseState.Y &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;-&lt;/SPAN&gt; 100) &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;%&lt;/SPAN&gt; 20) &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;/&lt;/SPAN&gt; 20;&lt;BR&gt;                        tiles[currentx, currenty].isblocked &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;true&lt;/SPAN&gt;;&lt;BR&gt;                        [updatedrawings]&lt;BR&gt;&lt;BR&gt;                    }&lt;BR&gt;                }&lt;BR&gt;            }&lt;BR&gt;&lt;BR&gt;            &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;if&lt;/SPAN&gt; (mouseState.RightButton == ButtonState.Pressed)&lt;BR&gt;            {&lt;BR&gt;                person &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:red;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; SearchingObject();&lt;BR&gt;                person.updatepath(tiles, &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; Vector2(2, 10), &lt;SPAN style="FONT-WEIGHT:normal;FONT-SIZE:11px;COLOR:blue;FONT-FAMILY:Courier New;BACKGROUND-COLOR:transparent;"&gt;new&lt;/SPAN&gt; Vector2(28, 10));&lt;BR&gt;            }&lt;BR&gt;}&lt;BR&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;</description></item></channel></rss>