diff options
author | Russ Cox <rsc@golang.org> | 2011-10-25 22:20:02 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-10-25 22:20:02 -0700 |
commit | db33959797ad8ef1e86725db62aafb40297ea725 (patch) | |
tree | 83205f46a52d3ebc4a22cc151968d958b8524b28 /test/solitaire.go | |
parent | 6ed3fa6553d84391157eae963eeee5f20b6dca74 (diff) | |
download | go-db33959797ad8ef1e86725db62aafb40297ea725.tar.gz go-db33959797ad8ef1e86725db62aafb40297ea725.zip |
cgo, goyacc, go/build, html, http, path, path/filepath, testing/quick, test: use rune
Nothing terribly interesting here.
R=golang-dev, bradfitz, gri, r
CC=golang-dev
https://golang.org/cl/5300043
Diffstat (limited to 'test/solitaire.go')
-rw-r--r-- | test/solitaire.go | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/test/solitaire.go b/test/solitaire.go index c789bf24a0..473a1d12d7 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") |