} // Use this for initialization public override EquationOperand GetRandomEquation(int quotient) { int divisor = 0; do { divisor = Random.Range(2, 51); // cap divisor at 50, and don't allow divide by 1 } while (divisor * quotient > 200); // cap dividend at 200 ValueOperand value1 = new ValueOperand(divisor); ValueOperand value2 = new ValueOperand(quotient * value1.GetValue()); return new EquationOperand(value2, this, value1); }
public override IOperationResult ToResult() { string result; if (ValueOperand is TextValueOperand) { string value = ((string)ValueOperand.GetValue()).TrimEnd('*').TrimStart('*'); result = string.Format("CONTAINS({0},'\"{1}*\"')", ColumnOperand, value); } else { result = string.Format("CONTAINS({0},'\"{1}*\"')", ColumnOperand, ValueOperand.GetValue()); } return(OperationResultBuilder.CreateResult(result)); }
public override IOperationResult ToResult() { string result; if (ValueOperand is TextValueOperand) { string value = (string)ValueOperand.GetValue(); result = value.Contains("*") ? string.Format("CONTAINS({0},'\"{1}\"')", ColumnOperand, value) : string.Format("CONTAINS({0},{1})", ColumnOperand, ValueOperand); } else { result = string.Format("CONTAINS({0},{1})", ColumnOperand, ValueOperand); } return(OperationResultBuilder.CreateResult(result)); }
// Use this for initialization public override EquationOperand GetRandomEquation(int difference) { ValueOperand value2 = new ValueOperand(Random.Range(1, difference)); //1 inclusuive, solution exclusive ValueOperand value1 = new ValueOperand(difference + value2.GetValue()); return new EquationOperand(value1, this, value2); }