How can the Minimax (or Negamax) algorithm be implemented in a game like Scotland Yard?

12 views Asked by At

I'm aware that Minimax/Negamax is used for two player games such as Chess. In Scotland Yard there is the MrX player and the detectives (usually 2-6), where MrX tries hiding from the detectives. If I wanted to extend the Minimax algorithm for Scotland Yard is it sufficient for me to simply swap turns/the maximising player when appropriate or is it less trivial?

Would this be sufficient? Pseudocode from wikipedia:

function negamax(node, depth) is
    if depth = 0 or node is a terminal node then
        return evaluatePosition() // From current player's perspective
    value := −∞
    for each child of node do
        value := max(value, −negamax(child, depth − 1))
    return value

In this case evaluatePosition() would return a +ve value if the position is favourable for MrX, and -ve for the detectives.

0

There are 0 answers