summaryrefslogtreecommitdiff
path: root/test/solitaire.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/solitaire.go')
-rw-r--r--test/solitaire.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/test/solitaire.go b/test/solitaire.go
index c789bf24a..473a1d12d 100644
--- a/test/solitaire.go
+++ b/test/solitaire.go
@@ -14,7 +14,7 @@ const N = 11 + 1 // length of a board row (+1 for newline)
// The board must be surrounded by 2 illegal fields in each direction
// so that move() doesn't need to check the board boundaries. Periods
// represent illegal fields, ● are pegs, and ○ are holes.
-var board = []int(
+var board = []rune(
`...........
...........
....●●●....
@@ -28,7 +28,6 @@ var board = []int(
...........
`)
-
// center is the position of the center hole if there is a single one;
// otherwise it is -1.
var center int
@@ -46,7 +45,6 @@ func init() {
}
}
-
var moves int // number of times move is called
// move tests if there is a peg at position pos that can jump over another peg
@@ -63,7 +61,6 @@ func move(pos, dir int) bool {
return false
}
-
// unmove reverts a previously executed valid move.
func unmove(pos, dir int) {
board[pos] = '●'
@@ -71,7 +68,6 @@ func unmove(pos, dir int) {
board[pos+2*dir] = '○'
}
-
// solve tries to find a sequence of moves such that there is only one peg left
// at the end; if center is >= 0, that last peg must be in the center position.
// If a solution is found, solve prints the board after each move in a backward
@@ -110,7 +106,6 @@ func solve() bool {
return false
}
-
func main() {
if !solve() {
println("no solution found")