Advertisement
Guest User

Java search best action

a guest
Jun 24th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. void search(State state, List<Action> actionsList, Turn turn) {
  2. State newState;
  3. double score;
  4. for (Action action : actionsList) {
  5. newState = applyAction(state, action);
  6. turn.actions.add(action);
  7. while (newState.phase != null) {
  8. search(newState, getAllActions(newState), turn);
  9. }
  10. score = calcScore(newState);
  11. if (score > maxScore) {
  12. maxScore = score;
  13. bestTurn = turn.duplicate();
  14. }
  15. turn.actions.remove(turn.actions.size() - 1);
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement