@@ -28,7 +28,7 @@ var board = []rune(
28
28
...........
29
29
` )
30
30
31
- // center is the position of the center hole if
31
+ // center is the position of the center hole if
32
32
// there is a single one; otherwise it is -1.
33
33
var center int
34
34
@@ -47,7 +47,7 @@ func init() {
47
47
48
48
var moves int // number of times move is called
49
49
50
- // move tests if there is a peg at position pos that
50
+ // move tests if there is a peg at position pos that
51
51
// can jump over another peg in direction dir. If the
52
52
// move is valid, it is executed and move returns true.
53
53
// Otherwise, move returns false.
@@ -69,11 +69,11 @@ func unmove(pos, dir int) {
69
69
board [pos + 2 * dir ] = '○'
70
70
}
71
71
72
- // solve tries to find a sequence of moves such that
73
- // there is only one peg left at the end; if center is
72
+ // solve tries to find a sequence of moves such that
73
+ // there is only one peg left at the end; if center is
74
74
// >= 0, that last peg must be in the center position.
75
75
// If a solution is found, solve prints the board after
76
- // each move in a backward fashion (i.e., the last
76
+ // each move in a backward fashion (i.e., the last
77
77
// board position is printed first, all the way back to
78
78
// the starting board position).
79
79
func solve () bool {
@@ -89,7 +89,7 @@ func solve() bool {
89
89
// see if this new board has a solution
90
90
if solve () {
91
91
unmove (pos , dir )
92
- println (string (board ))
92
+ fmt . Println (string (board ))
93
93
return true
94
94
}
95
95
unmove (pos , dir )
@@ -102,7 +102,7 @@ func solve() bool {
102
102
// tried each possible move
103
103
if n == 1 && (center < 0 || last == center ) {
104
104
// there's only one peg left
105
- println (string (board ))
105
+ fmt . Println (string (board ))
106
106
return true
107
107
}
108
108
// no solution found for this board
0 commit comments