public static string BoolOpTypeToString(BoolOPTypes type) { switch (type) { case BoolOPTypes.EQ: return("EQ"); case BoolOPTypes.NEQ: return("NEQ"); case BoolOPTypes.LT: return("LT"); case BoolOPTypes.LTE: return("LTE"); case BoolOPTypes.GT: return("GT"); case BoolOPTypes.GTE: return("GTE"); default: throw new InternalParseException("Failed to parse the boolean operator type. Type: " + type.ToString()); } }
public override float Run <T>(Dictionary <string, float> variables, CommandExecutor <T> executor, Dictionary <string, BoardFluid> dropPositions) { float leftResult = LeftBlock.Run(variables, executor, dropPositions); float rightResult = RightBlock.Run(variables, executor, dropPositions); switch (OPType) { case BoolOPTypes.EQ: return(leftResult == rightResult ? 1 : 0); case BoolOPTypes.NEQ: return(leftResult != rightResult ? 1 : 0); case BoolOPTypes.LT: return(leftResult < rightResult ? 1 : 0); case BoolOPTypes.LTE: return(leftResult <= rightResult ? 1 : 0); case BoolOPTypes.GT: return(leftResult > rightResult ? 1 : 0); case BoolOPTypes.GTE: return(leftResult >= rightResult ? 1 : 0); default: throw new InternalRuntimeException("Failed to parse the operator type. Type: " + OPType.ToString()); } }