Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. Move simpleFindMax(Postion posn, double alpha, double beta) {
  2. if (posn.maxPlayerWon()) {
  3. return artificial “Move” with value +inf;
  4. } else if (posn.minPlayerWon()) {
  5. return artificial “Move” with value -inf;
  6. }
  7. Move bestSoFar = artificial “Move” with value -inf;
  8. for (each M = a legal move for maximizing player from posn){
  9. Position next = posn.makeMove(M);
  10. next.setValue(heuristicEstimate(next));
  11. if (next.value() >= bestSoFar.value()) {
  12. bestSoFar = next;
  13. alpha = max(alpha, next.value());
  14. if (beta <= alpha) {
  15. break;
  16. }
  17. }
  18. }
  19. return bestSoFar;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement