Exemplo n.º 1
0
func (b Board) SearchWinPath(limit time.Duration) (*EVnode, error) {
	mnode := C.mnode_new(C.board_copy(b.b, b.ctx), b.ctx)
	defer C.mnode_free(mnode)
	Search_lock.Lock()
	defer Search_lock.Unlock()
	Search_limit = time.Now().Add(limit)
	Search_limit_exceeded = false

	enode := C.searchWinPath(mnode, b.ctx)
	if Search_limit_exceeded {
		return (*EVnode)(enode), errors.New("Time limit exceeded")
	}
	return (*EVnode)(enode), nil
}
Exemplo n.º 2
0
func (b Board) Copy() Board {
	cpy := Board{}
	cpy.b = C.board_copy(b.b, b.ctx)
	cpy.ctx = C.context_new((*b.ctx).nHoles, (*b.ctx).totalStones)
	return cpy
}