예제 #1
0
func NewMove(path Mask, color Color, cyclic bool) Move {
	mColor := Mask(color)
	mCyclic := Mask(0)
	if cyclic {
		mCyclic = 1
	}
	cMove := C.Move(path)
	cMove |= C.Move(mColor << C.COLOR_SHIFT)
	cMove |= C.Move(mCyclic << C.CYCLIC_SHIFT)
	return Move{cMove, path, color, cyclic}
}
예제 #2
0
func (board Board) Moves(moves chan Move) {
	q := newQueue()
	C.Moves(&board[0], (*C.Queue)(q))
	defer q.free()
	for _, move := range q.slice() {
		moves <- decodeMove(C.Move(move))
	}
	close(moves)
}