 
-hand_types = [ 'High Card', 'Pair', 'Two Pairs', 'Three of a Kind', 'Straight',
-'Flush', 'Full House', 'Four of a kind', 'Straight Flush' ]
+hand_types = [ 'high card', 'pair', 'two pairs', 'three of a kind', 'straight',
+'flush', 'full house', 'four of a kind', 'straight flush' ]
 
 compare_hands = (s) ->
 

            else
                @value = 'TJQKA'.indexOf(value) + 10

        to_s: () ->
            suit = {'C':'clubs','D':'diamonds','H':'hearts','S':'spades'}[@suit]
            value = @value
            if (@value > 10)
                value = {11:'Jack',12:'Queen',13:'King',14:'Ace'}[@value]

            "#{value} of #{suit}"
    
    cards = []
    for card in s.split(' ')


    if (p[1].type[0] == p[2].type[0])
        # check if all cards have same values
        for i in [1..5]
            if (p[1].type[i] > p[2].type[i])
                return result.replace('%1', p[1].name)
                             .replace('%2', type_to_s(p[1].type[0], p[1].type[i]))

            else if (p[1].type[i] < p[2].type[i])
                return result.replace('%1', p[2].name)
                             .replace('%2', type_to_s(p[2].type[0], p[2].type[i]))

            return 'Tie.' if (i == 5)

