Guest User

Untitled

a guest
Apr 24th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. MinMax (GamePosition game) {
  2. return MaxMove (game);
  3. }
  4. MaxMove (GamePosition game) {
  5. if (GameEnded(game)) {
  6. return EvalGameState(game);
  7. }
  8. else {
  9. best_move <- {};
  10. moves <- GenerateMoves(game);
  11. ForEach moves {
  12. move <- MinMove(ApplyMove(game));
  13. if (Value(move) > Value(best_move)) {
  14. best_move <- move;
  15. }
  16. }
  17. return best_move;
  18. }
  19. }
  20. MinMove (GamePosition game) {
  21. best_move <- {};
  22. moves <- GenerateMoves(game);
  23. ForEach moves {
  24. move <- MaxMove(ApplyMove(game));
  25. if (Value(move) > Value(best_move)) {
  26. best_move <- move;
  27. }
  28. }
  29. return best_move;
  30. }
Add Comment
Please, Sign In to add comment