Negamax - player moves twice

How do you handle games where, if the condition is met, the same player moves?

I tried something like this, but I don't think this is correct:

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
            if (condition is met) // the same player moves
               val := negamax(child, depth-1, α, β, color)
            else
               val := -negamax(child, depth-1, -β, -α, -color)
            if val≥β
                return val
            if val≥α
                α:=val
        return α
+5
source share
3 answers

Do not try to change the minimax algorithm yourself, instead change the presentation of the game for placement. There are basically two solutions:

  • , , . , , . AI , ( "" ) PSPACE hard ( n ), , . , , .
  • , , , , -. , , , , . , , . , , , , . , ,

, . , 2 , , .

, . AI - ( , tic-tac-toe ..) . , a. , , b. , negascout, , , . ( , , ..) , .

+10

negamax , node , , . - , , , "" ​​, . , , , . , , , . negamax , , -, , .

, !

+2

, .

0
source

All Articles