@@ -7,34 +7,34 @@ function knightTour(x, y, moveNum) {
77 var nextX = x + X [ i ] ;
88 var nextY = y + Y [ i ] ;
99
10- posTracer . _notify ( 0 , nextX ) . _wait ( ) ;
11- posTracer . _notify ( 1 , nextY ) . _wait ( ) ;
12- posTracer . _denotify ( 0 ) ;
13- posTracer . _denotify ( 1 ) ;
10+ posTracer . notify ( 0 , nextX ) . wait ( ) ;
11+ posTracer . notify ( 1 , nextY ) . wait ( ) ;
12+ posTracer . denotify ( 0 ) ;
13+ posTracer . denotify ( 1 ) ;
1414 /*
1515 Check if knight is still in the board
1616 Check that knight does not visit an already visited square
1717 */
1818 if ( nextX >= 0 && nextX < N && nextY >= 0 && nextY < N && board [ nextX ] [ nextY ] === - 1 ) {
1919 board [ nextX ] [ nextY ] = moveNum ;
2020
21- logTracer . _print ( 'Move to ' + nextX + ',' + nextY ) ;
22- boardTracer . _notify ( nextX , nextY , moveNum ) . _wait ( ) ;
23- boardTracer . _denotify ( nextX , nextY ) ;
24- boardTracer . _select ( nextX , nextY ) ;
21+ logTracer . print ( 'Move to ' + nextX + ',' + nextY ) ;
22+ boardTracer . notify ( nextX , nextY , moveNum ) . wait ( ) ;
23+ boardTracer . denotify ( nextX , nextY ) ;
24+ boardTracer . select ( nextX , nextY ) ;
2525
2626 var nextMoveNum = moveNum + 1 ;
2727 if ( knightTour ( nextX , nextY , nextMoveNum ) === true ) {
2828 return true ;
2929 } else {
30- logTracer . _print ( 'No place to move from ' + nextX + ',' + nextY + ': Backtrack' ) ;
30+ logTracer . print ( 'No place to move from ' + nextX + ',' + nextY + ': Backtrack' ) ;
3131 board [ nextX ] [ nextY ] = - 1 ; // backtrack
32- boardTracer . _notify ( nextX , nextY , - 1 ) . _wait ( ) ;
33- boardTracer . _denotify ( nextX , nextY ) ;
34- boardTracer . _deselect ( nextX , nextY ) ;
32+ boardTracer . notify ( nextX , nextY , - 1 ) . wait ( ) ;
33+ boardTracer . denotify ( nextX , nextY ) ;
34+ boardTracer . deselect ( nextX , nextY ) ;
3535 }
3636 } else {
37- logTracer . _print ( nextX + ',' + nextY + ' is not a valid move' ) ;
37+ logTracer . print ( nextX + ',' + nextY + ' is not a valid move' ) ;
3838 }
3939 }
4040 return false ;
@@ -44,16 +44,16 @@ board[0][0] = 0; // start from this position
4444pos [ 0 ] = 0 ;
4545pos [ 0 ] = 0 ;
4646
47- boardTracer . _notify ( 0 , 0 , 0 ) . _wait ( ) ;
48- posTracer . _notify ( 0 , 0 ) . _wait ( ) ;
49- posTracer . _notify ( 1 , 0 ) . _wait ( ) ;
50- boardTracer . _denotify ( 0 , 0 ) ;
51- boardTracer . _denotify ( 0 , 0 ) ;
52- posTracer . _denotify ( 0 ) ;
53- posTracer . _denotify ( 1 ) ;
47+ boardTracer . notify ( 0 , 0 , 0 ) . wait ( ) ;
48+ posTracer . notify ( 0 , 0 ) . wait ( ) ;
49+ posTracer . notify ( 1 , 0 ) . wait ( ) ;
50+ boardTracer . denotify ( 0 , 0 ) ;
51+ boardTracer . denotify ( 0 , 0 ) ;
52+ posTracer . denotify ( 0 ) ;
53+ posTracer . denotify ( 1 ) ;
5454
5555if ( knightTour ( 0 , 0 , 1 ) === false ) {
56- logTracer . _print ( 'Solution does not exist' ) ;
56+ logTracer . print ( 'Solution does not exist' ) ;
5757} else {
58- logTracer . _print ( 'Solution found' ) ;
58+ logTracer . print ( 'Solution found' ) ;
5959}
0 commit comments