             else
                 @value = 'TJQKA'.indexOf(value) + 10
 
+        value_s: () -> value_s(@value)
+
         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}"
+            "#{value_s} of #{suit}"
     
     cards = []
     for card in s.split(' ')


    if (p[1].type[0] == p[2].type[0])
        # check if all cards have same values
        # TODO refactor, and set the result type (e.g. 'high card: 9')
        for i in [1..5]
            return [p[1], p[2]]
            if (p[1].type[i].value > p[2].type[i].value)
                result.replace('%1', p[1].name)
                break
            else if (p[1].type[i].value < p[2].type[i].value)
                result.replace('%1', p[2.name])
                break

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


        return false if card.suit != suit

    true


# Return a string representation of the given card value
value_to_s = (value) ->
    return '' + value if (value <= 10)
    {11:'Jack',12:'Queen',13:'King',14:'Ace'}[value]

# Return a string representation of the given type, with
# a card value if the type is 0 (= high card)
type_to_s = (type, val) ->
    return hand_types[type] if (type > 0)
    hand_types[type] + ': ' + value_to_s(val)


# Return the maximal hand type found in an hand. This is a numbers Array,
