Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7069511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:27:16+00:00 2026-05-28T05:27:16+00:00

function negamax(node, depth, α, β, color) if node is a terminal node or depth

  • 0
function negamax(node, depth, α, β, color)
    if node is a terminal node or depth = 0
        return color * the heuristic value of node
    else
        foreach child of node
            val := -negamax(child, depth-1, -β, -α, -color)
            {the following if statement constitutes alpha-beta pruning}
            if val≥β
                return val
            if val≥α
                α:=val
        return α

So if the above is my negamax code (copied from wikipedia), and it is called as follows:

negamax(origin, depth, -inf, +inf, 1)

Then, will this function always return a positive value regardless of what depth we call the function with. This is assuming that the heuristic value by itself is always positive.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:27:16+00:00Added an answer on May 28, 2026 at 5:27 am

    Yes, if the evaluation score of the leaf node is positive, a positive value will be returned by negamax. That’s what the multiplication by the color value accomplishes, it ensures that there’s always a countering negation to reverse the final negation if there are an odd number of recursive negamax calls. This is because with an odd number of recursive calls, color will always equal -1. If there are an even number of recursive calls, all the negations cancel out and color will be 1, which will leave the returned value unaffected.

    Note that if you’re calling negamax with color == -1 (it’s the other side’s turn to move), you have to negate that call in order to get the correct value. That is:

    -negamax(origin, depth, -inf, +inf, -1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function register_contact ($person = array()) { $nogood = false; foreach ($person as $val) {
function dowork() { $(.wrappedElement).removeClass(wrappedElement); $(.wrappedElementout).removeClass(wrappedElementout); var a=$(div#DepPart select option:selected).val(); $(div#TestPart select option[value^=a]).addClass(wrappedElement); $(div#TestPart select
function getLink($sa){ if($sa=='1'){ $sa = 'qp_bbl'; } else { $sa = 'qp_sbl'; } return
Function calculate_attribute does not return a value; it only works through side effects. Often
function toggleLinkSelection(link){ if($(link).css('border-top-color') == 'red'){ $(link).css({'border-top-color': 'transparent'}); } else { $(div[id$='OptionsLink']).css({'border-top-color': 'transparent'}); $(link).css({'border-top-color': 'red'});
function returnsAnArray () { return array ('test'); } echo returnsAnArray ()[0]; generates a syntax
function Submit_click() { if (!bValidateFields()) return; } function bValidateFields() { /// <summary>Validation rules</summary> ///
function countChars(elm) { if (elm.nodeType == 3) { // TEXT_NODE return elm.nodeValue.length; } var
function myClass() { this.nums = [1,2,3]; this.divisor = 2; } myClass.prototype.divideNumsByDivisor = function(){ return
function strip_cdata($string) { preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $string, $matches); return str_replace($matches[0], $matches[1], $string); } I use the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.