From dec5bf5e5d07763e9a5ed0c87b4e219cb786aa99 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 26 Dec 2011 10:12:31 +0100 Subject: [PATCH] greed: stylistic changes Sort dices when rolling and separate values with spaces. --- data/rbot/plugins/games/greed.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/rbot/plugins/games/greed.rb b/data/rbot/plugins/games/greed.rb index c7dd4de3..3fa7d3be 100644 --- a/data/rbot/plugins/games/greed.rb +++ b/data/rbot/plugins/games/greed.rb @@ -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 -- 2.39.2