'''
Brian Crabtree
Uno.py
Simulate cards for the game "Uno"
'''

class UnoCard:
    # Pre-conditions: c must be in between 0 and 3 inclusive,
    #                 n must be in between 1 and 9, inclusive.
    def __init__(self, c, n):
        self.color = c
        self.number = n

    # Returns a String representation of a UnoCard. For example
    # the green card with 7 on it should be represented as
    # “Green 7”.
    def __str__(self):
        colorString = ""
        if self.color == 0:
            colorString = "Yellow "
        elif self.color == 1:
            colorString = "Red "
        elif self.color == 2:
            colorString = "Green "
        else:
            colorString = "Blue "
        return (colorString + str(self.number))
        
    # Returns true iff other can be played on this card or
    # vice versa.
    def canPlay(self, other):
        if self.color == other.color:
            return True
        elif self.number == other.number:
            return True
        return False
