def karpathy_transform(I):
    """Karpathy's Pong image transform converts 8bit images to binary images"""
    I[I == 144] = 0  # erase background (background type 1)
    I[I == 109] = 0  # erase background (background type 2)
    I[I != 0] = 1  # everything else (paddles, ball) just set to 1
    return I