Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Move simpleFindMax(Postion posn, double alpha, double beta) {
- if (posn.maxPlayerWon()) {
- return artificial “Move” with value +inf;
- } else if (posn.minPlayerWon()) {
- return artificial “Move” with value -inf;
- }
- Move bestSoFar = artificial “Move” with value -inf;
- for (each M = a legal move for maximizing player from posn){
- Position next = posn.makeMove(M);
- next.setValue(heuristicEstimate(next));
- if (next.value() >= bestSoFar.value()) {
- bestSoFar = next;
- alpha = max(alpha, next.value());
- if (beta <= alpha) {
- break;
- }
- }
- }
- return bestSoFar;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement