Permalink
Browse files

adding in a poker calculator from poker-lib, required some serious ca…

…rd class massages, but thats ok
  • Loading branch information...
1 parent 9cbb06e commit 1d40bc22ea8ba1576f92c17df4a6d2e035bcd280 Ben Feigin committed Feb 22, 2012
Showing with 541 additions and 23 deletions.
  1. +3 −3 db/schema.rb
  2. +1 −1 lib/deck.rb
  3. +486 −0 lib/poker_hand.rb
  4. +51 −19 models/cards.rb
View
@@ -59,12 +59,12 @@
end
create_table "cards", :force => true do |t|
- t.string :value, :null => false
- t.string :suit, :null => false
+ t.string :value_code, :null => false
+ t.string :suit_code, :null => false
t.references :dealable, :polymorphic => true, :null => false
t.integer :hand_id, :null => false
end
- add_index "cards", [:value, :suit, :hand_id], :name => 'non_duplicate_cards_per_hand', :unique => true
+ add_index "cards", [:value_code, :suit_code, :hand_id], :name => 'non_duplicate_cards_per_hand', :unique => true
create_table "accounts", :force => true do |t|
t.string "name"
View
@@ -20,7 +20,7 @@ def cards
def initialize
@cards = %w(C D H S).map do |suit|
- ((2..9).to_a + %w(T J Q K A)).map {|value| {:value => value, :suit => suit}}
+ ((2..9).to_a + %w(T J Q K A)).map {|value| {:value_code => value, :suit_code => suit}}
end.flatten.uniq.knuth_shuffle!
end
end
Oops, something went wrong. Retry.

0 comments on commit 1d40bc2

Please sign in to comment.