def reverse_tiles(tiles):
    """ Reverses tiles in a 16-bit row """
    new_tiles = 0
    for i in range(0, 4):
        new_tiles <<= 4
        new_tiles += tiles & 0b1111
        tiles >>= 4
    return new_tiles