Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alphabeta_full_search_max_value #31

Open
unhandyandy opened this issue Aug 8, 2021 · 0 comments
Open

alphabeta_full_search_max_value #31

unhandyandy opened this issue Aug 8, 2021 · 0 comments

Comments

@unhandyandy
Copy link

I have a couple questions about the alphabeta_full_search_max_value function in games.jl.

  1. Suppose that the state is terminal, and the utility function returns a value that is < beta but > alpha. Shouldn't that still change the value of alpha?
  2. My understanding is that in Julia numeric arguments to a function are passed by value. Since this function doesn't return the new value of alpha, I don't see how that value changes over the course of the search.
function alphabeta_full_search_max_value(game::T, player::String, state::String, alpha::Number, beta::Number) where {T <: AbstractGame}
	if (terminal_test(game, state))
		return utility(game, state, player)
	end
	local v::Float64 = -Inf64;
	for action in actions(game, state)
		v = max(v, alphabeta_full_search_min_value(game, player, result(game, state, action), alpha, beta));
        if (v >= beta)
            return v;
        end
        ### ! changes external variable alpha  ?
        alpha = max(alpha, v);
	end
	return v;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant