<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.lalex.com/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>LAlex devblog v6 - Erratum article sur le pathfinding A star  - Commentaires</title>
  <link>http://blog.lalex.com/</link>
  <atom:link href="http://blog.lalex.com/feed/rss2/comments/200" rel="self" type="application/rss+xml"/>
  <description></description>
  <language>fr</language>
  <pubDate>Fri, 28 Nov 2008 07:30:10 +0100</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
    
    <item>
    <title>Erratum article sur le pathfinding A star - dav</title>
    <link>http://blog.lalex.com/post/2004/04/26/Erratum-article-sur-le-pathfinding-A-star#c2326</link>
    <guid isPermaLink="false">urn:md5:1bdf582947a004e997189663822cd208</guid>
    <pubDate>Mon, 31 Oct 2005 11:28:38 +0000</pubDate>
    <dc:creator>dav</dc:creator>
    
    <description>&lt;p&gt;Salut trés interessant tout ca mais j'ai difficulté à comprendre comment le cout d'une case est attribué. D'après les tuto que j'ai lu 10 pour les cases adjacentes et 14 pour les diagonales mais lorsque j'utilise ta classe sans les diagonales il resout le chemin mais le chemin est trés long et trés complexe et lorsque j'utilise les diagonales il ne resout pas le chemin ou en tout cas il y a des trous.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Erratum article sur le pathfinding A star - xion</title>
    <link>http://blog.lalex.com/post/2004/04/26/Erratum-article-sur-le-pathfinding-A-star#c2231</link>
    <guid isPermaLink="false">urn:md5:5f109b96a5d2fbf3d2047444e3912b69</guid>
    <pubDate>Sun, 21 Aug 2005 22:48:13 +0000</pubDate>
    <dc:creator>xion</dc:creator>
    
    <description>&lt;p&gt;tu as raison, je n'avais pas pris en compte le fait que le tri fait revenir en arrière la recherche dès que cela devient moins intéressant (arghk, j'ai fait comment pour passer à côté ? &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_redface.gif&quot; alt=&quot;:$&quot; class=&quot;smiley&quot; /&gt; )...&lt;/p&gt;&lt;p&gt;à noter pour approfondir A* un lien des plus intéressants, mais je suppose que tu l'as déjà dans ta liste sur A* : &lt;a href=&quot;http://theory.stanford.edu/~amitp/GameProgramming/&quot; rel=&quot;nofollow&quot;&gt;http://theory.stanford.edu/~amitp/GameProgramming/&lt;/a&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Erratum article sur le pathfinding A star - LAlex</title>
    <link>http://blog.lalex.com/post/2004/04/26/Erratum-article-sur-le-pathfinding-A-star#c2220</link>
    <guid isPermaLink="false">urn:md5:0e8b8571e398a83049afa6abe1ffa9de</guid>
    <pubDate>Fri, 19 Aug 2005 00:05:18 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;xion &gt; Je vais regarder de ce côté plus en profondeur alors... &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt; J'avais de toutes façons l'intention de le faire évoluer pour qu'il gère les cases hexagonales, ce sera l'occasion de refaire tous mes tests... &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt; Je développe actuellement une mini-plateforme de test pour du pathfinding justement &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;&lt;p&gt;Par contre, tu te trompes sur la situation que tu donnes : en effet, plus le chemin va se rallonger, plus l'estimation de la &quot;valeur&quot; de la case (valeur H) sera importante. Il va donc tester éventuellement de rebrousser chemin s'il se trouve qu'une des cases qui rebroussent chemin devient plus interessante... C'est d'ailleurs là qu'intervient le tri de la liste ouverte... &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;&lt;p&gt;L'algo A* est a priori le plus fiable qui existe concernant le fait de trouver le chemin le plus court (enfin &lt;strong&gt;UN&lt;/strong&gt; des chemins les plus courts, i peut y en avoir plusieurs). Son inconvénient se situe au niveau des ressources processeur utilisées, qui peuvent devenir assez importantes... :o&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Erratum article sur le pathfinding A star - xion</title>
    <link>http://blog.lalex.com/post/2004/04/26/Erratum-article-sur-le-pathfinding-A-star#c2219</link>
    <guid isPermaLink="false">urn:md5:12ec5b2ddc43692fe00ddecbc7f200d1</guid>
    <pubDate>Thu, 18 Aug 2005 21:34:35 +0000</pubDate>
    <dc:creator>xion</dc:creator>
    
    <description>&lt;p&gt;Bon, bas j'ai l'impression que ce n'est pas un problème de mon implémentation, donc si jamais tu as des bugs ou autres chemins bizarres, tu pourras toujours chercher sur cette piste &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;&lt;p&gt;En tout cas je remarque, et c'est normal en fait, que ce genre de pathfinder trouve LE CHEMIN le plus évident à première vue... cependant, il ne trouve pas LE PLUS COURT CHEMIN.&lt;br /&gt;Il est normal de dire cela tout simplement parce que s'il la boucle passe dans un chemin fermé, mais assez long, tout en allant jusqu'à la sortie alors qu'il suffisait de rebrousser chemin (aller en direction oppopsée à celle où se trouve la case de fin) pour trouver une ligne droite sur un bord ou autre, et bien on trouvera bien un chemin qui marche, mais le pathfinder ne trouvera pas le MEILLEUR. Cependant, pour être certain de trouver le meilleur, on est obligé de tester tous les chemins possibles, donc ta gestion via A* est bien meilleure pour le processeur et trouvera toujours un chemin, malgré que ce ne sera pas forcément le meilleur... &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Erratum article sur le pathfinding A star - xion</title>
    <link>http://blog.lalex.com/post/2004/04/26/Erratum-article-sur-le-pathfinding-A-star#c2207</link>
    <guid isPermaLink="false">urn:md5:2c39190e8fe1e1fa067a2d987a29491b</guid>
    <pubDate>Tue, 16 Aug 2005 18:57:28 +0000</pubDate>
    <dc:creator>xion</dc:creator>
    
    <description>&lt;p&gt;Salut, merci de ta réponse ;).&lt;/p&gt;&lt;p&gt;Quand tu dis que l'arbre binaire est toujours trié... il l'est à chaque fois, mais pour une des deux branches principales... or dans certains cas, il peut y avoir une branche qui n'est finalement pas mise à jour.. (je suppose que c'était le cas dans mon exemple, car ça n'était pas un problème de non-optimisation, mais une erreur de chemin, qui amenait à des valeurs illogiques et qui sont fausses au niveau du chemin)&lt;/p&gt;&lt;p&gt;Cependant, n'étant pas sur mon ordi et n'ayant pas mon code de base, je ne puis dire si c'était plutôt une erreur de traitement pendant la gestion du tri de l'arbre... donc en attente &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;br /&gt;De plus j'essaierait d'utiliser ta version as2 pour voir si c'est une erreur ou bien un défaut de mon implémentation java...&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Erratum article sur le pathfinding A star - LAlex</title>
    <link>http://blog.lalex.com/post/2004/04/26/Erratum-article-sur-le-pathfinding-A-star#c2206</link>
    <guid isPermaLink="false">urn:md5:93c9fcadb0ea5ab65e5d445a7d5b380f</guid>
    <pubDate>Tue, 16 Aug 2005 10:06:51 +0000</pubDate>
    <dc:creator>LAlex</dc:creator>
    
    <description>&lt;p&gt;&lt;quote&gt;d'abord, si tu utilises ALLOW_DIAG, ne serait-ce pas plus logique d'utiliser if(!ALLOW_DIAG) pour la première condition étant donné que si on n'utilise pas les diagonales, on n'a pas la complication dont tu t'occupes après (dans le else) ?&lt;/p&gt;
&lt;p&gt;de plus, le calcul des diagonales me paraît faut :&lt;br /&gt;
var nbDiag = Math.abs(x1-x0-y1+y0);&lt;/quote&gt;Tu as tout à fait raison. Incroyable d'être passé la-dessus sans le voir. &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_redface.gif&quot; alt=&quot;:$&quot; class=&quot;smiley&quot; /&gt; Merci! &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_cool.gif&quot; alt=&quot;8)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;quote&gt;nbDiag * 14 ne marcherait pas ? ou alors une constante genre DEFAULT_DIAG_COST qui vaudrait 14 par exemple&lt;/quote&gt;En effet, c'est largement optimisable, mais plutôt en utilisant un ratio. Il n'est pas normal que l'on ai à modifier deux variables pour un chagement du coût par défaut. La solution serait d'utiliser une variable statique DIAG_RATIO. Si on veut être mathématiquement exact, ce serait DIAG_RATIO=Math.sqrt(2), et si on veut éviter trop de virgules, on peut mettre DIAG_RATIO =1.4...&lt;/p&gt;
&lt;p&gt;Ensuite, concernant le tri des arbres binaires, le ''&lt;=&quot; sert à éviter des boucles supplémentaires... En effet, ce tri fonctionne par permutations, et en fait, étant donné que le tableau est déjà trié et qu'on se contente de rajouter une nouvelle valeur, on peut considérer indifféremment qu'on va permuter deux valeurs égales ou non. J'ai choisi la deuxième option...&lt;br /&gt;
Je n'ai pas analysé en détail le cas pratique que tu donnes, mais a priori, a partir du moment ou le tableau est trié, ca devrait fonctionné. Peut-être que cela peut provoquer un chute des performances dans certains cas, mais ca devrait les améliorer dans d'autres cas... On ne peut pas tout avoir ! &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_mrgreen.gif&quot; alt=&quot;:mrgreen:&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;
&lt;p&gt;En gros, voici la méthode heuristique rectifiée grace a tes remarques :&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; DIAG_RATIO:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;sqrt&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;//.....&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; heuristic&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;mp:&lt;span style=&quot;color: #0066CC;&quot;&gt;Array&lt;/span&gt;, x0, y0, x1, y1&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;!ALLOW_DIAG&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;x1-x0&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;+&lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;y1-y0&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;*DEFAULT_COST;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; dX:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;x1-x0&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; dY:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;y1-y0&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;round&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;min&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;dX, dY&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;*DIAG_RATIO*DEFAULT_COST&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;+&lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;dX-dY&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;*DEFAULT_COST;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Je vais republier la classe rectifiée. Merci encore de tes infos.&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Erratum article sur le pathfinding A star - xion</title>
    <link>http://blog.lalex.com/post/2004/04/26/Erratum-article-sur-le-pathfinding-A-star#c2205</link>
    <guid isPermaLink="false">urn:md5:d1e395af0a9840f4e1a109eb98b38d48</guid>
    <pubDate>Mon, 15 Aug 2005 19:10:44 +0000</pubDate>
    <dc:creator>xion</dc:creator>
    
    <description>&lt;p&gt;resalut... je ne sais pas si c'est propre à ma méthode réimplémentation, mais bon, je le poste quand même...&lt;/p&gt;&lt;p&gt;j'ai réimplémenté la base de ton pathfinder, en l'orientant plus objet et en changeant certains point structurel, cependant cela en java...&lt;br /&gt;et au final, j'ai réussi à faire marcher ça correctement, mais juste avant de trouver la fin, je suis resté bloqué sur un point qui était pourtant compréhensible...&lt;/p&gt;&lt;p&gt;Ta méthode de tri de l'open :&lt;br /&gt;&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; sortOpenListFrom&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;lst,ind&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;Void&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;BINARY_HEAPS&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; curInd:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = ind;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// On trie d'un enfant vers son parent&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Si l'indice est 1, on arrete car on est en&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// haut de l'arbre&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;curInd &amp;gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; parInd = &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;floor&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;curInd/&lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Si le parent a un cout inferieur, on arrete le tri&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;curInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;totCost&lt;/span&gt; &amp;gt;= lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;parInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;totCost&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; tmp:&lt;span style=&quot;color: #0066CC;&quot;&gt;Object&lt;/span&gt; = lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;parInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;parInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; = lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;curInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;curInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; = tmp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; curInd = parInd;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;Je ne sais pas si ça marche en as2, étant donné que je n'ai testé que mon implémentation java, mais en java ça foire...La relation d'erreur est faite entre :&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;curInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;totCost&lt;/span&gt; &amp;gt;= lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;parInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;totCost&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;et&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; heur:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = PathFinder.&lt;span style=&quot;color: #006600;&quot;&gt;heuristic&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;mp,curX,curY,x1,y1&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; newPt:&lt;span style=&quot;color: #0066CC;&quot;&gt;Object&lt;/span&gt; = &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt; x:curX, y:curY, pathCost:curPathCost, togoCost:heur, totCost:curPathCost+heur, parent:curPnt &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cloneMap&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;curX&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;curY&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; = newPt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PathFinder.&lt;span style=&quot;color: #006600;&quot;&gt;open&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;openList, newPt&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;Je m'explique :Imaginons que j'ai une surface sans bloqueur.Je suis à (2,2) et je vais à (10,0).Chez moi ça a bloqué à partir de (5,0)... pourquoi :-à 4.1 : F(5,0) = 88 (d'après mon implémentation, mais cela ne change rien), disons F(5,0) = VALUE;or F(5,1) = 88 aussi (VALUE) mais c'est normalétant donné la manière de tourner des boucles, c'est à 5.0 que ça passe-à 5.0 : F(6,0) = 88 (VALUE), ce qui est juste, c'est en fait le seul point acceptable à ce momentor F(5.1) qui normalement devrait valoir une valeur plus grande étant donné que la valeur de retour de l'heuristique est relative à chaque case.. bas c'est pas le cas étant donné que la boucle n'a pas encore passé à 5.1 et donc il vaut toujours 88 (VALUE), sa valeur précédente...Dans le tri, on va avoir 6.0 qui remonte, et son parent 5.1 ne le laissera pas passé, alors qu'il le ferait s'il était à jour... c'est dû à ton&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;curInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;totCost&lt;/span&gt; &amp;gt;= lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;parInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;totCost&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;Donc il suffit d'écrire :&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;curInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;totCost&lt;/span&gt; &amp;gt; lst&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;parInd&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;totCost&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;et hop, tous les cases sont totalement triées... et il n'y a plus de problèmes du tout &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;br /&gt;Je ne sais pas si j'ai fait une modification lors de mon implémentation java qui n'a pas la même structure je l'avoue, mais étant donné que dans mon implémentation java cela a causé des problèmes, je le notifie ici &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;&lt;p&gt;Si j'ai oublié quelque chose qui justifierai ton signe et son égalité, dites-le-moi &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Erratum article sur le pathfinding A star - xion</title>
    <link>http://blog.lalex.com/post/2004/04/26/Erratum-article-sur-le-pathfinding-A-star#c2204</link>
    <guid isPermaLink="false">urn:md5:0ec12f0bbc0cf3315d3bfa91e73b22c2</guid>
    <pubDate>Sun, 14 Aug 2005 13:55:32 +0000</pubDate>
    <dc:creator>xion</dc:creator>
    
    <description>&lt;p&gt;resorry, la dernière phrase, c'est plutôt Pourquoi se compliquer avec ...&lt;br /&gt;nbDiag * 14 ne marcherait pas ? ou alors une constante genre DEFAULT_DIAG_COST qui vaudrait 14 par exemple &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Erratum article sur le pathfinding A star - xion</title>
    <link>http://blog.lalex.com/post/2004/04/26/Erratum-article-sur-le-pathfinding-A-star#c2203</link>
    <guid isPermaLink="false">urn:md5:92954a140e02d7e0ce9a13b8d1c8e122</guid>
    <pubDate>Sun, 14 Aug 2005 13:52:12 +0000</pubDate>
    <dc:creator>xion</dc:creator>
    
    <description>&lt;p&gt;arghk, sorry pour toutes les fautes de frappe (c'était pas intentionnel :))&lt;br /&gt;autre question comme ça, quand tu crées les valeurs, juste après,la valeur des diagonales multipliée par un nombre...&lt;br /&gt;ayant lu les articles en anglais, et surtout ta traduction, les diagonales utilisaient une simple valeur 14 à la place de 10...&lt;br /&gt;pour se compliquer avec : nbDiag*Math.sqrt(2*DEFAULT_COST)) ?&lt;/p&gt;</description>
  </item>
      
    
    <item>
    <title>Erratum article sur le pathfinding A star - xion</title>
    <link>http://blog.lalex.com/post/2004/04/26/Erratum-article-sur-le-pathfinding-A-star#c2202</link>
    <guid isPermaLink="false">urn:md5:7778af3930f424b66469e0ece42cc079</guid>
    <pubDate>Sun, 14 Aug 2005 13:47:50 +0000</pubDate>
    <dc:creator>xion</dc:creator>
    
    <description>&lt;p&gt;Salut, j'ai un peu disséquer, et en tomber sur ta méthode heuristique... bas au premier abord, quelque chose clochait, et au deuxième, bas il y en a deux de choses qui clochent :(.&lt;/p&gt;&lt;p&gt;C'est pas si grave, mais bon, dans la méthode :&lt;br /&gt;&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Heuristique Manhatan&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0066CC;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; heuristic&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;mp:&lt;span style=&quot;color: #0066CC;&quot;&gt;Array&lt;/span&gt;, x0, y0, x1, y1&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;ALLOW_DIAG&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;x1-x0&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;+&lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;y1-y0&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;*DEFAULT_COST;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Nombre de diagonale&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; nbDiag = &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;x1-x0-y1+y0&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Nombre de lignes droites&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; nbLine = &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;x1-x0&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;,&lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;y1-y0&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;-nbDiag;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;round&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;nbDiag*&lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;sqrt&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;*DEFAULT_COST&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;+nbLine*DEFAULT_COST;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;d'abord, si tu utilises ALLOW_DIAG, ne serait-ce pas plus logique d'utiliser if(!ALLOW_DIAG) pour la première condition étant donné que si on n'utilise pas les diagonales, on n'a pas la complication dont tu t'occupes après (dans le else) ?de plus, le calcul des diagonales me paraît faut :var nbDiag = Math.abs(x1-x0-y1+y0);j'utiliserai plutôt :var nbDiag = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)); // étant donné que c'est le minimum par rapport au déplacement en x ou y &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;cependant, ton système marche à certain coup... donc ça n'a pas dû t'étonner :&lt;code class=&quot;actionscript&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; x1:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;, x0:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;, y1:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;, y0:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt;;&lt;br /&gt;
x1 = &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;;&lt;br /&gt;
y1 = &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;
x0 = &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;
y0 = &lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; nbDiag:&lt;span style=&quot;color: #0066CC;&quot;&gt;Number&lt;/span&gt; = &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;x1-x0-y1+y0&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;nbDiag&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
nbDiag = &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;min&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;x0 - x1&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;span style=&quot;color: #0066CC;&quot;&gt;Math&lt;/span&gt;.&lt;span style=&quot;color: #0066CC;&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;y0 - y1&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #0066CC;&quot;&gt;trace&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;nbDiag&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;sortie : 1 et 1, oki &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;mais changeons les valeurs par :&lt;code class=&quot;actionscript&quot;&gt;x1 = &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;;&lt;br /&gt;
y1 = &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;
x0 = &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;
y0 = &lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt;;&lt;/code&gt;&lt;br /&gt;sortie : 0 pour ton code, 1 pour l'utilisation du min &lt;img src=&quot;http://common.lalex.com/themes/devblog/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt; et 0, c'est pas très possible dans le monde des distances entre deux points différents&lt;/p&gt;&lt;p&gt;ah moins que j'ai loupé quelque chose ?&lt;br /&gt;&lt;/p&gt;</description>
  </item>
      
</channel>
</rss>