#!/usr/bin/ruby class Deck TOTAL_CARDS = 52 def initialize initialize_deck end def initialize_deck @card_deck = Array.new(TOTAL_CARDS) {|i| ((i/4)+2)} end def shuffle for i in 0..51 card_swap(rand(TOTAL_CARDS), rand(TOTAL_CARDS)) end end def card_swap(card_one, card_two) temp_card = @card_deck[card_one] @card_deck[card_one] = @card_deck[card_two] @card_deck[card_two] = temp_card end def get_bottom_half bottom_deck = Array.new(26) for i in 0..((TOTAL_CARDS / 2) - 1) bottom_deck[i] = @card_deck[i] end return bottom_deck end def get_top_half top_deck = Array.new(26) for i in (TOTAL_CARDS / 2)..(TOTAL_CARDS - 1) top_deck[i] = @card_deck[i] end return top_deck.compact! end def full_shuffle shuffle shuffle shuffle end end