lib/euchre/round.rb
#function to deal hands to players
function to deal hands to players
function to deal hands to players
def deal_cards
    i = 0
    while @player4.hand.length != 5 do
      i += 1
      if i.odd?
        [2,3,2,3].each do |n|
          cards = []
          n.times {cards.push(@deck.deal_card)}
          @current_player.add_cards(cards)
          next_player
        end
      else
        [3,2,3,2].each do |n|
          cards = []
          n.times {cards.push(@deck.deal_card)}
          @current_player.add_cards(cards)
          next_player
        end
      end
    end
    send_all_cards
    @turnup = @deck.deal_card
    ActionCable.server.broadcast(@channel,{ "img" => @turnup.b64_img, "kitty" => true })
    sleep(0.1)
    @pass_count = 0
    pickup_or_pass
  end
def deal_cards i = 0 while @player4 . hand . length != 5 do i += 1 if i . odd? [ 2 , 3 , 2 , 3 ] . each do | n | cards = [ ] n . times { cards . push ( @deck . deal_card ) } @current_player . add_cards ( cards ) next_player end else [ 3 , 2 , 3 , 2 ] . each do | n | cards = [ ] n . times { cards . push ( @deck . deal_card ) } @current_player . add_cards ( cards ) next_player end end end send_all_cards @turnup = @deck . deal_card ActionCable . server . broadcast ( @channel , { "img" => @turnup . b64_img , "kitty" => true } ) sleep ( 0.1 ) @pass_count = 0 pickup_or_pass end
function to deal hands to players
function to deal hands to players
#set turnup card and send to players #declare a counter to keep track of how many times players have passed