diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-13 22:19:45 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-13 22:19:45 +0100 |
commit | 38212f89578111324c096d9bab55f2225a1d4d76 (patch) | |
tree | bfd68ad858a4c66a4ce941ae28a826794f28f955 | |
parent | dedf0c19d272f48c8d9d8949e838ba9dda73020a (diff) |
math plugin: fix some english-to-math translations
-rw-r--r-- | data/rbot/plugins/math.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/data/rbot/plugins/math.rb b/data/rbot/plugins/math.rb index afa4737c..945b2c78 100644 --- a/data/rbot/plugins/math.rb +++ b/data/rbot/plugins/math.rb @@ -80,19 +80,20 @@ class MathPlugin < Plugin expr.gsub!(/\bover /, "/ ") expr.gsub!(/\bsquared/, "**2 ") expr.gsub!(/\bcubed/, "**3 ") - expr.gsub!(/\bto\s+(\d+)(r?st|nd|rd|th)?( power)?/, "**\1 ") + expr.gsub!(/\bto\s+(\d+)(r?st|nd|rd|th)?( power)?/, '**\1 ') expr.gsub!(/\bpercent of/, "*0.01*") expr.gsub!(/\bpercent/, "*0.01") expr.gsub!(/\% of\b/, "*0.01*") expr.gsub!(/\%/, "*0.01") - expr.gsub!(/\bsquare root of (\d+)/, "\1 ** 0.5 ") - expr.gsub!(/\bcubed? root of (\d+)/, "\1 **(1.0/3.0) ") + expr.gsub!(/\bsquare root of (\d+)/, '\1 ** 0.5 ') + expr.gsub!(/\bcubed? root of (\d+)/, '\1 **(1.0/3.0) ') expr.gsub!(/ of /, " * ") expr.gsub!(/(bit(-| )?)?xor(\'?e?d( with))?/, "^") expr.gsub!(/(bit(-| )?)?or(\'?e?d( with))?/, "|") expr.gsub!(/bit(-| )?and(\'?e?d( with))?/, "& ") expr.gsub!(/(plus|and)/, "+") + debug expr if (expr =~ /^\s*[-\d*+\s()\/^\.\|\&\*\!]+\s*$/ && expr !~ /^\s*\(?\d+\.?\d*\)?\s*$/ && expr !~ /^\s*$/ && |