Skip to content

alphabeta_full_search_max_value #31

@unhandyandy

Description

@unhandyandy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions