rgooler / fchat_pokerbot_ruby

Pokerbot redone in ruby
1 stars 2 forks source link

Create Custom Build Jammer #3

Closed Jammer2omega closed 11 years ago

Jammer2omega commented 11 years ago

Added a few more 'accessories' while learning the code Hello, and Hi responses.

Different number deck drawing (1, 2 and 3)

Start of the !slap and !MMs command.

as well as a !Drawe command, which will hopefully let you draw a number of cards = to e.

Jammer2omega commented 11 years ago

!/usr/bin/env ruby

-- encoding: utf-8 --

class Deck attr_accessor :deck attr_accessor :num_decks

def initialize(decks=1) @num_decks = decks self.send('generate') end

Draw 5 cards for the game

def draw() hand = @deck.pop(5) p hand if @deck.length() <= 5 self.send('generate') end return hand.join(" ") end

def drawe() hand = @deck.pop(@value) p hand if @deck.length() <= 5 self.send('generate') end return hand.join(" ") end

def draw1()
hand = @deck.pop(1)
p hand
if @deck.length() <= 5
   self.send('generate')
end
return hand.join(" ")

end

def draw2()
hand = @deck.pop(2)
p hand
if @deck.length() <= 5
   self.send('generate')
end
return hand.join(" ")

end

def draw3()
hand = @deck.pop(3)
p hand
if @deck.length() <= 5
   self.send('generate')
end
return hand.join(" ")

end

def generate() @deck = Array.new() @num_decks.times { |i| ['[color=yellow]♠[/color]', '♣', '[color=red]♥[/color]', '[color=blue]♦[/color]'].each do |suit| %w{A 2 3 4 5 6 7 8 9 10 J Q K}.each do |rank| @deck << "#{rank}#{suit}" end end } @deck.shuffle! p @deck end

end