Created
May 15, 2010 07:52
-
-
Save trshafer/402088 to your computer and use it in GitHub Desktop.
Kings Cup in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'active_support' | |
while (deck ||= %w(Diamond Heart Spade Club).collect{ |suit| {'Ace' => 'Waterfall', 2 => 'You', 3 => 'Me', 4 => 'Women of Society', 5 => 'Category', 6 => 'Gentlemen', 7 => 'Heaven', 8 => 'Mate', 9 => 'Rhyme', 'Jack' => 'Thumb Master', 'Queen' => 'Questions', 'King' => 'Pour'}.collect{|card, rule| "#{(card)} of #{suit}s: #{rule}"} }.flatten.shuffle).select {|card| card =~ /king/i}.present? do puts deck.pop end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
553 characters (318 variable condensing).