Skip to content

Commit

Permalink
changed minimax back
Browse files Browse the repository at this point in the history
  • Loading branch information
mbluemer committed May 2, 2017
1 parent 6b93529 commit 43d3e00
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/MinimaxSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ double MinimaxSearch::alphaBeta(bup &board, double alpha, double beta, int depth
v = std::numeric_limits<double>::lowest();
for (mup &move : board->actions()) {
bup result = board->result(move);
alpha = std::max(alpha, alphaBeta(result, alpha, beta, depth + 1));
if (beta <= alpha) return beta;
v = std::max(v, alphaBeta(result, alpha, beta, depth + 1));
if (v >= beta) return v;
alpha = std::max(alpha, v);
}
} else {
v = std::numeric_limits<double>::max();
for (mup &move : board->actions()) {
bup result = board->result(move);
beta = std::min(beta, alphaBeta(result, alpha, beta, depth + 1));
if (beta <= alpha) return alpha;
v = std::min(v, alphaBeta(result, alpha, beta, depth + 1));
if (v <= alpha) return v;
beta = std::min(beta, v);
}
}

Expand Down

0 comments on commit 43d3e00

Please sign in to comment.