4 # :title: Greed dice game plugin for rbot
6 # Author:: Okasu <oka.sux@gmail.com>
8 # Distributed under the same license as rbot itself
19 def help(plugin, topic="")
20 "Simple dice game. Rules: https://en.wikipedia.org/wiki/Greed_(dice_game)"
33 one = two = three = four = five = six = score = 0
80 if roll.sort == [1,2,3,4,5,6]
82 elsif roll.sort == [2,2,3,3,4,4]
90 mhash = {m.sourcenick => player[0]}
91 @scoreboard.merge! mhash
92 m.reply "You have #{player[0]} points. (#{player[1].join("-")})"
93 if params[:single] == "bot"
95 m.reply "I have #{bot[0]} points. (#{bot[1].join("-")})"
99 m.reply "Human player wins!"
102 if @scoreboard.values.size == 2
103 if @scoreboard.values[0] > @scoreboard.values[1]
104 m.reply "#{@scoreboard.keys.first} wins!"
106 m.reply "#{@scoreboard.keys.last} wins!"
114 plugin.map "greed :single", :action => :greed, :requirements => {:single => /bot/}, :thread => "yes"
115 plugin.map "greed", :action => :greed, :thread => "yes"