// Path: src/main/java/interpreter/Check.java
// public class Check {
// 
//     private String data1;
//     private String data2;
//     private Operator operator;
// 
//     private static final BaseLogger LOGGER = new BaseLogger("Check");
// 
//     /**
//      *
//      * Default constructor when not dealing with user input.
//      *
//      * @param data1 First data element
//      * @param data2 Second data element
//      * @param operator  Operator for comparison
//      */
//     public Check(String data1, String data2, Operator operator) {
//         this.data1 = data1;
//         this.data2 = data2;
//         this.operator = operator;
//     }
// 
//     public String getData1() {
//         return data1;
//     }
// 
//     public String getData2() {
//         return data2;
//     }
// 
//     public Operator getOperator() {
//         return operator;
//     }
// 
// 
//     /**
//      * Based on the current game state data, returns if condition is true.
//      *
//      * @param game takes in the model
//      * @return if defined condition is true
//      */
//     boolean conditionIsTrue(Game game, int id) {
// 
//         int data1 = getData(this.data1, game, id);
//         int data2 = getData(this.data2, game, id);
// 
//         switch (this.operator){
//             case LESS_THAN:
//                 return data1 < data2;
//             case GREATER_THAN:
//                 return data1 > data2;
//             case LESS_THAN_OR_EQUAL_TO:
//                 return data1 <= data2;
//             case GREATER_THAN_OR_EQUAL_TO:
//                 return data1 >= data2;
//             case EQUALS:
//                 return data1 == data2;
//             default:
//                 return false;  // should never happen, but Java is Java
//         }
//     }
// 
// 
//     /**
//      * Based on the current game state data, returns if condition is true.
//      *
//      * @param data takes in the data to be returned
//      * @param game is the pointer to the game model
//      * @return the integer value of the game data that has been looked up
//      */
//     private int getData(String data, Game game, int id) {
// 
//         int otherId;
//         if (id == 0){otherId = 1;}else{otherId = 0;}
// 
//         if (data.equals(Data.USER_HEALTH.text())) {
//             return game.getPlayer(id).getHealth();
//         } else if (data.equals(Data.OPPONENT_HEALTH.text())) {
//             return game.getPlayer(otherId).getHealth();
//         } else if (data.equals(Data.DISTANCE_FROM_OPPONENT.text())) {
//             return game.pathDistanceToPlayer(id, otherId);
//         } else {
//             try {
//                 return Integer.parseInt(data);
//             } catch (Exception ex) {
//                 LOGGER.critical("Unable to parse '" + data + "' as Data.");
//                 return -1;
//             }
//         }
//     }
// }
// 
// Path: src/main/java/interpreter/ScriptCommand.java
// public class ScriptCommand {
// 
//     private List<Check> checks;
//     private Command command;
//     private static final BaseLogger LOGGER = new BaseLogger("ScriptCommand");
// 
//     public ScriptCommand(List<Check> checks, Command command) {
//         this.checks = checks;
//         this.command = command;
//     }
// 
//     /**
//      * @return the command enum
//      */
//     public Command getCommand() {
//         return command;
//     }
// 
//     /**
//      * @return the list of checks for this command
//      */
//     public List<Check> getChecks() {
//         return checks;
//     }
// 
//     /**
//      * Method called to excecute a 'line' of the interpreter.
//      *
//      * @param game the instance of the game class passed in
//      * @param id the id of the player excecuting this script
//      * @return true if the command excecuted
//      */
//     public boolean doCommand(Game game, int id){
// 
//         for (Check c: this.checks){
//             if (!c.conditionIsTrue(game, id)) {
//                 return false;
//             }
//         }
//         executeFunction(game, id);
//         return true;
//     }
// 
//     /**
//      * Called by doCommand to actually modify the game data with built-in functions
//      *
//      * @param game the instance of the game class passed in
//      * @param id the id of the player executing this script
//      */
//     private void executeFunction(Game game, int id){
// 
//         int otherId;
// 
//         if (id == 0){otherId = 1;}else{otherId = 0;}
// 
//         if(id == 1){
//             LOGGER.debug("Executing attack for player " + id + " "+ this.command);
//         }
// 
//         switch(this.command){
//             case APPROACH:
//                 game.approach(id, otherId);
//                 break;
//             case ATTACK:
//                 game.attack(id);
//                 break;
//             case HEAL:
//                 game.heal(id, 9);
//                 break;
//             case EVADE:
//                 game.evade(id, otherId);
//             case DO_NOTHING:
//                 game.doNothing(id);
//                 break;
//             case DEFEND:
//                 game.defend(id);
//                 break;
//             case SELF_DESTRUCT:
//                 game.selfDestruct(id);
//             default:
//                 game.doNothing(id);
//                 break;
//         }
//     }
// }


import interpreter.Check;
import interpreter.ScriptCommand;
import interpreter.enumerations.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.TextInputDialog;
import javax.management.InstanceNotFoundException;
import java.util.*;
import java.util.stream.Collectors;

                try {
                    op = getOperator(scriptingObjects.get(i + 1));
                } catch (InstanceNotFoundException e) {
                    e.printStackTrace();
                    // Should never happen
                    return null;
                }

                Check check = new Check(scriptingObjects.get(i),
                        scriptingObjects.get(i + 2),
                        op);
                checks.add(check);

                // increment to end of the check that was located
                i = i + 2;
            }
        }
        return checks;
    }

    private static Operator getOperator(String text) throws InstanceNotFoundException {
        for (Operator operator : Operator.values()) {
            if (text.trim().equals(operator.text())) {
                return operator;
            }
        }
        throw new InstanceNotFoundException();
    }

// Path: src/main/java/interpreter/Check.java
// public class Check {
// 
//     private String data1;
//     private String data2;
//     private Operator operator;
// 
//     private static final BaseLogger LOGGER = new BaseLogger("Check");
// 
//     /**
//      *
//      * Default constructor when not dealing with user input.
//      *
//      * @param data1 First data element
//      * @param data2 Second data element
//      * @param operator  Operator for comparison
//      */
//     public Check(String data1, String data2, Operator operator) {
//         this.data1 = data1;
//         this.data2 = data2;
//         this.operator = operator;
//     }
// 
//     public String getData1() {
//         return data1;
//     }
// 
//     public String getData2() {
//         return data2;
//     }
// 
//     public Operator getOperator() {
//         return operator;
//     }
// 
// 
//     /**
//      * Based on the current game state data, returns if condition is true.
//      *
//      * @param game takes in the model
//      * @return if defined condition is true
//      */
//     boolean conditionIsTrue(Game game, int id) {
// 
//         int data1 = getData(this.data1, game, id);
//         int data2 = getData(this.data2, game, id);
// 
//         switch (this.operator){
//             case LESS_THAN:
//                 return data1 < data2;
//             case GREATER_THAN:
//                 return data1 > data2;
//             case LESS_THAN_OR_EQUAL_TO:
//                 return data1 <= data2;
//             case GREATER_THAN_OR_EQUAL_TO:
//                 return data1 >= data2;
//             case EQUALS:
//                 return data1 == data2;
//             default:
//                 return false;  // should never happen, but Java is Java
//         }
//     }
// 
// 
//     /**
//      * Based on the current game state data, returns if condition is true.
//      *
//      * @param data takes in the data to be returned
//      * @param game is the pointer to the game model
//      * @return the integer value of the game data that has been looked up
//      */
//     private int getData(String data, Game game, int id) {
// 
//         int otherId;
//         if (id == 0){otherId = 1;}else{otherId = 0;}
// 
//         if (data.equals(Data.USER_HEALTH.text())) {
//             return game.getPlayer(id).getHealth();
//         } else if (data.equals(Data.OPPONENT_HEALTH.text())) {
//             return game.getPlayer(otherId).getHealth();
//         } else if (data.equals(Data.DISTANCE_FROM_OPPONENT.text())) {
//             return game.pathDistanceToPlayer(id, otherId);
//         } else {
//             try {
//                 return Integer.parseInt(data);
//             } catch (Exception ex) {
//                 LOGGER.critical("Unable to parse '" + data + "' as Data.");
//                 return -1;
//             }
//         }
//     }
// }
// 
// Path: src/main/java/interpreter/ScriptCommand.java
// public class ScriptCommand {
// 
//     private List<Check> checks;
//     private Command command;
//     private static final BaseLogger LOGGER = new BaseLogger("ScriptCommand");
// 
//     public ScriptCommand(List<Check> checks, Command command) {
//         this.checks = checks;
//         this.command = command;
//     }
// 
//     /**
//      * @return the command enum
//      */
//     public Command getCommand() {
//         return command;
//     }
// 
//     /**
//      * @return the list of checks for this command
//      */
//     public List<Check> getChecks() {
//         return checks;
//     }
// 
//     /**
//      * Method called to excecute a 'line' of the interpreter.
//      *
//      * @param game the instance of the game class passed in
//      * @param id the id of the player excecuting this script
//      * @return true if the command excecuted
//      */
//     public boolean doCommand(Game game, int id){
// 
//         for (Check c: this.checks){
//             if (!c.conditionIsTrue(game, id)) {
//                 return false;
//             }
//         }
//         executeFunction(game, id);
//         return true;
//     }
// 
//     /**
//      * Called by doCommand to actually modify the game data with built-in functions
//      *
//      * @param game the instance of the game class passed in
//      * @param id the id of the player executing this script
//      */
//     private void executeFunction(Game game, int id){
// 
//         int otherId;
// 
//         if (id == 0){otherId = 1;}else{otherId = 0;}
// 
//         if(id == 1){
//             LOGGER.debug("Executing attack for player " + id + " "+ this.command);
//         }
// 
//         switch(this.command){
//             case APPROACH:
//                 game.approach(id, otherId);
//                 break;
//             case ATTACK:
//                 game.attack(id);
//                 break;
//             case HEAL:
//                 game.heal(id, 9);
//                 break;
//             case EVADE:
//                 game.evade(id, otherId);
//             case DO_NOTHING:
//                 game.doNothing(id);
//                 break;
//             case DEFEND:
//                 game.defend(id);
//                 break;
//             case SELF_DESTRUCT:
//                 game.selfDestruct(id);
//             default:
//                 game.doNothing(id);
//                 break;
//         }
//     }
// }


// Path: src/main/java/gui/scripting/MouseEvents.java
import interpreter.Check;
import interpreter.ScriptCommand;
import interpreter.enumerations.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.TextInputDialog;
import javax.management.InstanceNotFoundException;
import java.util.*;
import java.util.stream.Collectors;


                try {
                    op = getOperator(scriptingObjects.get(i + 1));
                } catch (InstanceNotFoundException e) {
                    e.printStackTrace();
                    // Should never happen
                    return null;
                }

                Check check = new Check(scriptingObjects.get(i),
                        scriptingObjects.get(i + 2),
                        op);
                checks.add(check);

                // increment to end of the check that was located
                i = i + 2;
            }
        }
        return checks;
    }

    private static Operator getOperator(String text) throws InstanceNotFoundException {
        for (Operator operator : Operator.values()) {
            if (text.trim().equals(operator.text())) {
                return operator;
            }
        }
        throw new InstanceNotFoundException();
    }

    List<ScriptCommand> getCommands() {