Skip to content

Instantly share code, notes, and snippets.

@trshafer
Created May 15, 2010 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trshafer/402088 to your computer and use it in GitHub Desktop.
Save trshafer/402088 to your computer and use it in GitHub Desktop.
Kings Cup in Ruby
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
@trshafer
Copy link
Author

553 characters (318 variable condensing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment