Home | History | Annotate | Download | only in test

Lines Matching refs:board

11 // This program solves the (English) peg solitaire board game.
16 const N = 11 + 1 // length of a board row (+1 for newline)
18 // The board must be surrounded by 2 illegal fields in each direction
19 // so that move() doesn't need to check the board boundaries. Periods
21 var board = []rune(
41 for pos, field := range board {
59 if board[pos] == '?' && board[pos+dir] == '?' && board[pos+2*dir] == '?' {
60 board[pos] = '?'
61 board[pos+dir] = '?'
62 board[pos+2*dir] = '?'
70 board[pos] = '?'
71 board[pos+dir] = '?'
72 board[pos+2*dir] = '?'
77 // If a solution is found, solve prints the board after each move in a backward
78 // fashion (i.e., the last board position is printed first, all the way back to
79 // the starting board position).
82 for pos, field := range board {
83 // try each board position
90 // see if this new board has a solution
93 println(string(board))
106 println(string(board))
109 // no solution found for this board