File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -134,15 +134,15 @@ var astar = {
134
134
// See list of heuristics: http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html
135
135
heuristics : {
136
136
manhattan : function ( pos0 , pos1 ) {
137
- var d1 = Math . abs ( pos1 . x - pos0 . x ) ;
138
- var d2 = Math . abs ( pos1 . y - pos0 . y ) ;
137
+ var d1 = Math . abs ( pos1 . x - pos0 . x ) ;
138
+ var d2 = Math . abs ( pos1 . y - pos0 . y ) ;
139
139
return d1 + d2 ;
140
140
} ,
141
141
diagonal : function ( pos0 , pos1 ) {
142
142
var D = 1 ;
143
143
var D2 = Math . sqrt ( 2 ) ;
144
- var d1 = Math . abs ( pos1 . x - pos0 . x ) ;
145
- var d2 = Math . abs ( pos1 . y - pos0 . y ) ;
144
+ var d1 = Math . abs ( pos1 . x - pos0 . x ) ;
145
+ var d2 = Math . abs ( pos1 . y - pos0 . y ) ;
146
146
return ( D * ( d1 + d2 ) ) + ( ( D2 - ( 2 * D ) ) * Math . min ( d1 , d2 ) ) ;
147
147
}
148
148
}
You can’t perform that action at this time.
0 commit comments