]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
UNO!: fix g9r9 fix
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 8 Nov 2010 19:25:06 +0000 (20:25 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 8 Nov 2010 19:25:06 +0000 (20:25 +0100)
Commit a306b2c68eb58c1c88057ff7ee78895401adb6a9 introduced a fix to
prevent a player from playing something like g9r9, but the fix actually
prevented any single-card play. Fix by making the \1 optional.

data/rbot/plugins/games/uno.rb

index adaa127f15bb34845ea51a4f86b83c892988b545..6a0562789e463f4d9056e6c2acd4a3134e386e75 100644 (file)
@@ -382,7 +382,7 @@ class UnoGame
   def play_card(source, cards)
     debug "Playing card #{cards}"
     p = get_player(source)
-    shorts = cards.gsub(/\s+/,'').match(/^(?:([rbgy]\+?\d)\1|([rbgy][rs])|(w(?:\+4)?)([rbgy])?)$/).to_a
+    shorts = cards.gsub(/\s+/,'').match(/^(?:([rbgy]\+?\d)\1?|([rbgy][rs])|(w(?:\+4)?)([rbgy])?)$/).to_a
     debug shorts.inspect
     if shorts.empty?
       announce _("what cards were that again?")