@@ -21,7 +21,7 @@ var generateRandom = function (width, height, wallFrequency) {
21
21
22
22
for ( var y = 0 ; y < height ; y ++ ) {
23
23
var isWall = Math . floor ( Math . random ( ) * ( 1 / wallFrequency ) ) ;
24
- if ( isWall == 0 ) {
24
+ if ( isWall === 0 ) {
25
25
nodeRow . push ( WALL ) ;
26
26
}
27
27
else {
@@ -96,7 +96,7 @@ var css = { start: "start", finish: "finish", wall: "wall", active: "active" };
96
96
function GraphSearch ( $graph , options , implementation ) {
97
97
this . $graph = $graph ;
98
98
this . search = implementation ;
99
- this . opts = $ . extend ( { wallFrequency :.1 , debug :true , gridSize :10 } , options ) ;
99
+ this . opts = $ . extend ( { wallFrequency :0 .1, debug :true , gridSize :10 } , options ) ;
100
100
this . initialize ( ) ;
101
101
}
102
102
GraphSearch . prototype . setOption = function ( opt ) {
@@ -131,7 +131,7 @@ GraphSearch.prototype.initialize = function() {
131
131
gridRow . push ( $cell ) ;
132
132
133
133
var isWall = Math . floor ( Math . random ( ) * ( 1 / self . opts . wallFrequency ) ) ;
134
- if ( isWall == 0 ) {
134
+ if ( isWall === 0 ) {
135
135
nodeRow . push ( WALL ) ;
136
136
$cell . addClass ( css . wall ) ;
137
137
}
@@ -184,7 +184,7 @@ GraphSearch.prototype.cellClicked = function($end) {
184
184
var fTime = performance ? performance . now ( ) : new Date ( ) . getTime ( ) ,
185
185
duration = ( fTime - sTime ) . toFixed ( 2 ) ;
186
186
187
- if ( ! path || path . length == 0 ) {
187
+ if ( path . length = == 0 ) {
188
188
$ ( "#message" ) . text ( "couldn't find a path (" + duration + "ms)" ) ;
189
189
this . animateNoPath ( ) ;
190
190
}
@@ -239,7 +239,7 @@ GraphSearch.prototype.animatePath = function(path) {
239
239
var self = this ;
240
240
// will add start class if final
241
241
var removeClass = function ( path , i ) {
242
- if ( i >= path . length ) { // finished removing path, set start positions
242
+ if ( i >= path . length ) { // finished removing path, set start positions
243
243
return setStartClass ( path , i ) ;
244
244
}
245
245
elementFromNode ( path [ i ] ) . removeClass ( css . active ) ;
@@ -254,7 +254,7 @@ GraphSearch.prototype.animatePath = function(path) {
254
254
}
255
255
} ;
256
256
var addClass = function ( path , i ) {
257
- if ( i >= path . length ) { // Finished showing path, now remove
257
+ if ( i >= path . length ) { // Finished showing path, now remove
258
258
return removeClass ( path , 0 ) ;
259
259
}
260
260
elementFromNode ( path [ i ] ) . addClass ( css . active ) ;
0 commit comments