@@ -7,34 +7,34 @@ function knightTour(x, y, moveNum) {
7
7
var nextX = x + X [ i ] ;
8
8
var nextY = y + Y [ i ] ;
9
9
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 ) ;
14
14
/*
15
15
Check if knight is still in the board
16
16
Check that knight does not visit an already visited square
17
17
*/
18
18
if ( nextX >= 0 && nextX < N && nextY >= 0 && nextY < N && board [ nextX ] [ nextY ] === - 1 ) {
19
19
board [ nextX ] [ nextY ] = moveNum ;
20
20
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 ) ;
25
25
26
26
var nextMoveNum = moveNum + 1 ;
27
27
if ( knightTour ( nextX , nextY , nextMoveNum ) === true ) {
28
28
return true ;
29
29
} else {
30
- logTracer . _print ( 'No place to move from ' + nextX + ',' + nextY + ': Backtrack' ) ;
30
+ logTracer . print ( 'No place to move from ' + nextX + ',' + nextY + ': Backtrack' ) ;
31
31
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 ) ;
35
35
}
36
36
} else {
37
- logTracer . _print ( nextX + ',' + nextY + ' is not a valid move' ) ;
37
+ logTracer . print ( nextX + ',' + nextY + ' is not a valid move' ) ;
38
38
}
39
39
}
40
40
return false ;
@@ -44,16 +44,16 @@ board[0][0] = 0; // start from this position
44
44
pos [ 0 ] = 0 ;
45
45
pos [ 0 ] = 0 ;
46
46
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 ) ;
54
54
55
55
if ( knightTour ( 0 , 0 , 1 ) === false ) {
56
- logTracer . _print ( 'Solution does not exist' ) ;
56
+ logTracer . print ( 'Solution does not exist' ) ;
57
57
} else {
58
- logTracer . _print ( 'Solution found' ) ;
58
+ logTracer . print ( 'Solution found' ) ;
59
59
}
0 commit comments