Skip to content

Instantly share code, notes, and snippets.

@Marthyn
Created January 27, 2014 16:30
Show Gist options
  • Save Marthyn/8651868 to your computer and use it in GitHub Desktop.
Save Marthyn/8651868 to your computer and use it in GitHub Desktop.
valid = false
operations = []
formula = Formula.new(operations)
while !valid
operations << Operation.new(
AVAILABLE_OPERATORS["Multiplication"],
Constant.new(Float((rand(1...1000)*10))/100),
Constant.new(Float(1 + rand(1...40)).round(2))
)
formula = Formula.new(operations)
valid = (user_skill.level-10..user_skill.level+10).include?(formula.difficulty)
end
theory = "#{formula.operations[0].constant1.value*100}% van #{formula.operations[0].constant2.value}#{unit}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment