@@ -312,12 +312,11 @@ const Maze: React.FC<Props> = (props) => {
312
312
dfsStack,
313
313
} = props . maze ;
314
314
315
- // console.log(selectedAlgo);
316
315
if ( selectedAlgo === "BFS" ) {
317
316
let queue = bfsQueue ;
318
317
// This gets run once at the start
319
318
if ( isPlaying && queue . length === 0 ) {
320
- console . log ( "Init BFS" ) ;
319
+ // console.log("Init BFS");
321
320
const start = getStart ( mazeInfo ) ;
322
321
323
322
if ( start ) {
@@ -327,7 +326,7 @@ const Maze: React.FC<Props> = (props) => {
327
326
328
327
setTimeout ( function ( ) {
329
328
if ( queue . length > 0 && isPlaying ) {
330
- console . log ( "Going through BFS" , queue ) ;
329
+ // console.log("Going through BFS", queue);
331
330
332
331
// Removes any queued spaces that were previously visited
333
332
while ( mazeInfo [ queue [ 0 ] . y ] [ queue [ 0 ] . x ] . visited ) {
@@ -362,7 +361,7 @@ const Maze: React.FC<Props> = (props) => {
362
361
let stack = dfsStack ;
363
362
// This gets run once at the start
364
363
if ( isPlaying && stack . length === 0 ) {
365
- console . log ( "Init DFS" ) ;
364
+ // console.log("Init DFS");
366
365
const start = getStart ( mazeInfo ) ;
367
366
368
367
if ( start ) {
@@ -405,7 +404,7 @@ const Maze: React.FC<Props> = (props) => {
405
404
406
405
// Run at the beginning
407
406
if ( isPlaying && openSet . length === 0 ) {
408
- console . log ( "Init Astar" ) ;
407
+ // console.log("Init Astar");
409
408
const start = getStart ( mazeInfo ) ;
410
409
411
410
if ( start ) {
@@ -415,15 +414,14 @@ const Maze: React.FC<Props> = (props) => {
415
414
416
415
setTimeout ( function ( ) {
417
416
if ( isPlaying && openSet . length > 0 ) {
418
- console . log ( "Running Astar" ) ;
417
+ // console.log("Running Astar");
419
418
let newMazeInfo = mazeInfo ;
420
419
let current = getLowestFScore ( openSet , mazeInfo ) ;
421
420
const end = getEnd ( mazeInfo ) as Coord ;
422
421
423
422
// Check if finished
424
423
if ( includesCoord ( closedSet , end ) ) {
425
424
// Find the Path
426
- console . log ( "DONE" ) ;
427
425
handlePauseVisualization ( ) ;
428
426
// openSet = [];
429
427
return ;
@@ -466,15 +464,13 @@ const Maze: React.FC<Props> = (props) => {
466
464
neighborSpace . h = heuristic ( neighbor , end ) ;
467
465
}
468
466
neighborSpace . f = neighborSpace . g + neighborSpace . h ;
469
- console . log ( "Setting parent of " , neighbor , current ) ;
470
467
neighborSpace . parent = current ;
471
468
}
472
469
} ) ;
473
470
474
471
progressAstar ( openSet , closedSet , newMazeInfo , end ) ;
475
472
}
476
473
} else {
477
- console . log ( "NO SOLUTION" ) ;
478
474
if ( isPlaying ) handlePauseVisualization ( ) ;
479
475
return ;
480
476
}
@@ -485,7 +481,7 @@ const Maze: React.FC<Props> = (props) => {
485
481
486
482
// Run at the beginning
487
483
if ( isPlaying && openSet . length === 0 ) {
488
- console . log ( "Init Djikstras" ) ;
484
+ // console.log("Init Djikstras");
489
485
const start = getStart ( mazeInfo ) ;
490
486
491
487
if ( start ) {
@@ -495,15 +491,14 @@ const Maze: React.FC<Props> = (props) => {
495
491
496
492
setTimeout ( function ( ) {
497
493
if ( isPlaying && openSet . length > 0 ) {
498
- console . log ( "Running Djikstras" ) ;
494
+ // console.log("Running Djikstras");
499
495
let newMazeInfo = mazeInfo ;
500
496
let current = getLowestFScore ( openSet , mazeInfo ) ;
501
497
const end = getEnd ( mazeInfo ) as Coord ;
502
498
503
499
// Check if finished
504
500
if ( includesCoord ( closedSet , end ) ) {
505
501
// Find the Path
506
- console . log ( "DONE" ) ;
507
502
handlePauseVisualization ( ) ;
508
503
// openSet = [];
509
504
return ;
@@ -547,15 +542,13 @@ const Maze: React.FC<Props> = (props) => {
547
542
neighborSpace . h = heuristic_djikstras ( neighbor , end ) ;
548
543
}
549
544
neighborSpace . f = neighborSpace . g + neighborSpace . h ;
550
- console . log ( "Setting parent of " , neighbor , current ) ;
551
545
neighborSpace . parent = current ;
552
546
}
553
547
} ) ;
554
548
555
549
progressAstar ( openSet , closedSet , newMazeInfo , end ) ;
556
550
}
557
551
} else {
558
- console . log ( "NO SOLUTION" ) ;
559
552
if ( isPlaying ) handlePauseVisualization ( ) ;
560
553
return ;
561
554
}
0 commit comments