def game(true_yx, pred_yx, image_hw, L):
    """
    Computes Grid Average Mean absolute Error (GAME) from yx points.

    Args: 
        - true_yx: (N,2)-array of groundtruth points
        - pred_yx: (N,2)-array of predicted points
        - L: grid level, the image space will be divided in 4 ** L patches
    Returns:
        Value of the GAME-L metric.
    """
    val = 0.0
    image_h, image_w = image_hw
    patch_h, patch_w = image_h / 2**L, image_w / 2**L
    for r in range(2**L):
        sy, ey = patch_h * r, patch_h * (r + 1)
        true_y, pred_y = true_yx[:, 0], pred_yx[:, 0]
        true_x_filtered = true_yx[(true_y >= sy) & (true_y < ey), 1]
        pred_x_filtered = pred_yx[(pred_y >= sy) & (pred_y < ey), 1]
        for c in range(2**L):
            sx, ex = patch_w * c, patch_w * (c + 1)
            n_true = ((true_x_filtered >= sx) & (true_x_filtered < ex)).sum()
            n_pred = ((pred_x_filtered >= sx) & (pred_x_filtered < ex)).sum()
            val += abs(n_pred - n_true)
    
    return val