OSDN Git Service

regular expressoin is available for matching player name
authorbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Mon, 23 Jun 2008 14:34:51 +0000 (14:34 +0000)
committerbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Mon, 23 Jun 2008 14:34:51 +0000 (14:34 +0000)
mk_rate

diff --git a/mk_rate b/mk_rate
index f3eb94e..d072ae1 100755 (executable)
--- a/mk_rate
+++ b/mk_rate
@@ -707,7 +707,16 @@ def main
       rating.integer!
 
       if $options["fixed-rate-player"]
+        # first, try exact match
         index = win_loss_matrix.keys.index($options["fixed-rate-player"])
+        # second, try regular match
+        unless index
+          win_loss_matrix.keys.each_with_index do |p, i|
+            if %r!#{$options["fixed-rate-player"]}! =~ p
+              index = i
+            end
+          end
+        end
         if index
           the_rate = rating.rate[index]
           rating.translate!($options["fixed-rate"] - the_rate)