Module: HandEvaluator
- Defined in:
- ext/hand_evaluator/hand_evaluator.c
Class Method Summary collapse
-
.rank_hand(ruby_card_list) ⇒ int
The rank of the hand.
Class Method Details
.rank_hand(ruby_card_list) ⇒ int
Returns The rank of the hand.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'ext/hand_evaluator/hand_evaluator.c', line 18
static VALUE rank_hand(VALUE self, VALUE ruby_card_list) {
VALUE* card_list = RARRAY_PTR(ruby_card_list);
int card_list_length = RARRAY_LEN(ruby_card_list);
int card;
Cardset card_set = emptyCardset();
int i;
for(i = 0; i < card_list_length; ++i) {
card = NUM2INT(card_list[i]);
addCardToCardset(&card_set, suitOfCard(card),
rankOfCard(card));
}
return INT2NUM(rankCardset(card_set));
}
|