Interface UndoableAction


public interface UndoableAction
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    doAction(double currentScore, double desparationValue)
    Perform an action
    boolean
    Was the last action deterministic? That is, if it wasn't chosen and state is still as before is it worth doing it again?
    boolean
    Was the last call to doAction() succesful?
    boolean
    Undo the last action (if it was successful) Users of undoable actions should accept that sometimes it isn't possible.
  • Method Details

    • doAction

      double doAction(double currentScore, double desparationValue)
      Perform an action
      Parameters:
      currentscore - The current score before doing the action
      desparationValue - An indication by the processing machines of willingness to do more extreme actions. A value of 0 means not desparate at all, a value of 1 means very desparate
      Returns:
      the current score after doing the action (or the input score if not successful)
    • isActionDeterministic

      boolean isActionDeterministic()
      Was the last action deterministic? That is, if it wasn't chosen and state is still as before is it worth doing it again?
      Returns:
      true if last action deterministic
    • isActionSuccessful

      boolean isActionSuccessful()
      Was the last call to doAction() succesful?
      Returns:
      true if last action successful, false otherwise
    • undoAction

      boolean undoAction()
      Undo the last action (if it was successful) Users of undoable actions should accept that sometimes it isn't possible. If an undo was not possible the action should not change any state
      Returns:
      true if undo was successful