]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
greed: stylistic changes
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 26 Dec 2011 09:12:31 +0000 (10:12 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 26 Dec 2011 09:12:31 +0000 (10:12 +0100)
Sort dices when rolling and separate values with spaces.

data/rbot/plugins/games/greed.rb

index c7dd4de3b12c6d21f983c56bd9eecd4fd1ec5103..3fa7d3be8a85d26df79a399de16fd5022367b83a 100644 (file)
@@ -25,7 +25,7 @@ class Greed < Plugin
     for i in 0..5 do
       dice[i] = rand(6) + 1
     end
-    dice
+    dice.sort
   end
 
   def scores
@@ -77,9 +77,9 @@ class Greed < Plugin
         end
       end
     end
-    if roll.sort == [1,2,3,4,5,6]
+    if roll == [1,2,3,4,5,6]
       score = 1200
-    elsif roll.sort == [2,2,3,3,4,4]
+    elsif roll == [2,2,3,3,4,4]
       score = 800
     end
     [score, roll]
@@ -89,10 +89,10 @@ class Greed < Plugin
     player = scores
     mhash = {m.sourcenick => player[0]}
     @scoreboard.merge! mhash
-    m.reply "You have #{player[0]} points. (#{player[1].join("-")})"
+    m.reply "You have #{player[0]} points. (#{player[1].join(" ")})"
     if params[:single] == "bot"
       bot = scores
-      m.reply "I have #{bot[0]} points. (#{bot[1].join("-")})"
+      m.reply "I have #{bot[0]} points. (#{bot[1].join(" ")})"
       if player[0] < bot[0]
         m.reply "Bot wins!"
       else