broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    block_columns = (p["w"]+3)//4
    block_rows = max(1,p["h"]//3)
    padded_columns = ((block_columns+2)//3)*3
    block_size = p["endpoints"]+12
    row_pitch = padded_columns*block_size
    block_start = p["base"]+(p["y"]//3)*row_pitch+(p["x"]//4)*block_size
    selector_id = (p["y"]%3)*4+p["x"]%4
    selector_address = block_start+p["endpoints"]+selector_id
    allocation = row_pitch*block_rows
    block_valid_texels = min(4,p["w"]-(p["x"]//4)*4)*min(3,p["h"]-(p["y"]//3)*3)
    return {'block_columns': block_columns, 'block_rows': block_rows, 'padded_columns': padded_columns, 'block_size': block_size, 'row_pitch': row_pitch, 'block_start': block_start, 'selector_id': selector_id, 'selector_address': selector_address, 'allocation': allocation, 'block_valid_texels': block_valid_texels}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 0, 'selector_address': 16, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 9, 'selector_address': 25, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 147, 'selector_id': 0, 'selector_address': 152, 'allocation': 153, 'block_valid_texels': 4}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 266, 'selector_id': 7, 'selector_address': 278, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 283, 'selector_id': 8, 'selector_address': 296, 'allocation': 408, 'block_valid_texels': 6}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 215, 'selector_id': 3, 'selector_address': 223, 'allocation': 255, 'block_valid_texels': 4})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 0, 'selector_address': 27, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 9, 'selector_address': 36, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 158, 'selector_id': 0, 'selector_address': 163, 'allocation': 153, 'block_valid_texels': 9}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 277, 'selector_id': 7, 'selector_address': 289, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 294, 'selector_id': 8, 'selector_address': 307, 'allocation': 408, 'block_valid_texels': 9}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 226, 'selector_id': 3, 'selector_address': 234, 'allocation': 255, 'block_valid_texels': 4})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 0, 'selector_address': 38, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 9, 'selector_address': 47, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 4, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 169, 'selector_id': 0, 'selector_address': 174, 'allocation': 204, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 288, 'selector_id': 7, 'selector_address': 300, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 305, 'selector_id': 8, 'selector_address': 318, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 237, 'selector_id': 3, 'selector_address': 245, 'allocation': 255, 'block_valid_texels': 4})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 0, 'selector_address': 49, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 9, 'selector_address': 58, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 282, 'selector_id': 0, 'selector_address': 287, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 299, 'selector_id': 7, 'selector_address': 311, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 316, 'selector_id': 8, 'selector_address': 329, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 248, 'selector_id': 3, 'selector_address': 256, 'allocation': 255, 'block_valid_texels': 4})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 0, 'selector_address': 60, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 9, 'selector_address': 69, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 293, 'selector_id': 0, 'selector_address': 298, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 310, 'selector_id': 7, 'selector_address': 322, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 327, 'selector_id': 8, 'selector_address': 340, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 259, 'selector_id': 3, 'selector_address': 267, 'allocation': 255, 'block_valid_texels': 4})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    block_columns = (p["w"]+3)//4
    block_rows = (p["h"]+3)//4
    padded_columns = ((block_columns+2)//3)*3
    block_size = p["endpoints"]+12
    row_pitch = padded_columns*block_size
    block_start = p["base"]+(p["y"]//3)*row_pitch+(p["x"]//4)*block_size
    selector_id = (p["y"]%3)*4+p["x"]%4
    selector_address = block_start+p["endpoints"]+selector_id
    allocation = row_pitch*block_rows
    block_valid_texels = min(4,p["w"]-(p["x"]//4)*4)*min(3,p["h"]-(p["y"]//3)*3)
    return {'block_columns': block_columns, 'block_rows': block_rows, 'padded_columns': padded_columns, 'block_size': block_size, 'row_pitch': row_pitch, 'block_start': block_start, 'selector_id': selector_id, 'selector_address': selector_address, 'allocation': allocation, 'block_valid_texels': block_valid_texels}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 0, 'selector_address': 16, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 9, 'selector_address': 25, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 147, 'selector_id': 0, 'selector_address': 152, 'allocation': 153, 'block_valid_texels': 4}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 266, 'selector_id': 7, 'selector_address': 278, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 283, 'selector_id': 8, 'selector_address': 296, 'allocation': 408, 'block_valid_texels': 6}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 215, 'selector_id': 3, 'selector_address': 223, 'allocation': 255, 'block_valid_texels': 4})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 0, 'selector_address': 27, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 9, 'selector_address': 36, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 158, 'selector_id': 0, 'selector_address': 163, 'allocation': 153, 'block_valid_texels': 9}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 277, 'selector_id': 7, 'selector_address': 289, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 294, 'selector_id': 8, 'selector_address': 307, 'allocation': 408, 'block_valid_texels': 9}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 226, 'selector_id': 3, 'selector_address': 234, 'allocation': 255, 'block_valid_texels': 4})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 0, 'selector_address': 38, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 9, 'selector_address': 47, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 4, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 169, 'selector_id': 0, 'selector_address': 174, 'allocation': 204, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 288, 'selector_id': 7, 'selector_address': 300, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 305, 'selector_id': 8, 'selector_address': 318, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 237, 'selector_id': 3, 'selector_address': 245, 'allocation': 255, 'block_valid_texels': 4})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 0, 'selector_address': 49, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 9, 'selector_address': 58, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 282, 'selector_id': 0, 'selector_address': 287, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 299, 'selector_id': 7, 'selector_address': 311, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 316, 'selector_id': 8, 'selector_address': 329, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 248, 'selector_id': 3, 'selector_address': 256, 'allocation': 255, 'block_valid_texels': 4})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 0, 'selector_address': 60, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 9, 'selector_address': 69, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 293, 'selector_id': 0, 'selector_address': 298, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 310, 'selector_id': 7, 'selector_address': 322, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 327, 'selector_id': 8, 'selector_address': 340, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 259, 'selector_id': 3, 'selector_address': 267, 'allocation': 255, 'block_valid_texels': 4})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The returned physical layout descriptor disagrees with the declared buffer mapping at block_rows.

A stipulated 4x3 block format stores 5 endpoint bytes followed by twelve one-byte texel selectors. Block rows are padded to a multiple of three blocks; selector lookup never decodes colors. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    block_columns = (p["w"]+3)//4
    block_rows = (p["h"]+2)//3
    padded_columns = block_columns
    block_size = p["endpoints"]+12
    row_pitch = padded_columns*block_size
    block_start = p["base"]+(p["y"]//3)*row_pitch+(p["x"]//4)*block_size
    selector_id = (p["y"]%3)*4+p["x"]%4
    selector_address = block_start+p["endpoints"]+selector_id
    allocation = row_pitch*block_rows
    block_valid_texels = min(4,p["w"]-(p["x"]//4)*4)*min(3,p["h"]-(p["y"]//3)*3)
    return {'block_columns': block_columns, 'block_rows': block_rows, 'padded_columns': padded_columns, 'block_size': block_size, 'row_pitch': row_pitch, 'block_start': block_start, 'selector_id': selector_id, 'selector_address': selector_address, 'allocation': allocation, 'block_valid_texels': block_valid_texels}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 0, 'selector_address': 16, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 9, 'selector_address': 25, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 147, 'selector_id': 0, 'selector_address': 152, 'allocation': 153, 'block_valid_texels': 4}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 266, 'selector_id': 7, 'selector_address': 278, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 283, 'selector_id': 8, 'selector_address': 296, 'allocation': 408, 'block_valid_texels': 6}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 215, 'selector_id': 3, 'selector_address': 223, 'allocation': 255, 'block_valid_texels': 4})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 0, 'selector_address': 27, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 9, 'selector_address': 36, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 158, 'selector_id': 0, 'selector_address': 163, 'allocation': 153, 'block_valid_texels': 9}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 277, 'selector_id': 7, 'selector_address': 289, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 294, 'selector_id': 8, 'selector_address': 307, 'allocation': 408, 'block_valid_texels': 9}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 226, 'selector_id': 3, 'selector_address': 234, 'allocation': 255, 'block_valid_texels': 4})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 0, 'selector_address': 38, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 9, 'selector_address': 47, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 4, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 169, 'selector_id': 0, 'selector_address': 174, 'allocation': 204, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 288, 'selector_id': 7, 'selector_address': 300, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 305, 'selector_id': 8, 'selector_address': 318, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 237, 'selector_id': 3, 'selector_address': 245, 'allocation': 255, 'block_valid_texels': 4})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 0, 'selector_address': 49, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 9, 'selector_address': 58, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 282, 'selector_id': 0, 'selector_address': 287, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 299, 'selector_id': 7, 'selector_address': 311, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 316, 'selector_id': 8, 'selector_address': 329, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 248, 'selector_id': 3, 'selector_address': 256, 'allocation': 255, 'block_valid_texels': 4})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 0, 'selector_address': 60, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 9, 'selector_address': 69, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 293, 'selector_id': 0, 'selector_address': 298, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 310, 'selector_id': 7, 'selector_address': 322, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 327, 'selector_id': 8, 'selector_address': 340, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 259, 'selector_id': 3, 'selector_address': 267, 'allocation': 255, 'block_valid_texels': 4})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    block_columns = (p["w"]+3)//4
    block_rows = (p["h"]+2)//3
    padded_columns = (block_columns//3+1)*3
    block_size = p["endpoints"]+12
    row_pitch = padded_columns*block_size
    block_start = p["base"]+(p["y"]//3)*row_pitch+(p["x"]//4)*block_size
    selector_id = (p["y"]%3)*4+p["x"]%4
    selector_address = block_start+p["endpoints"]+selector_id
    allocation = row_pitch*block_rows
    block_valid_texels = min(4,p["w"]-(p["x"]//4)*4)*min(3,p["h"]-(p["y"]//3)*3)
    return {'block_columns': block_columns, 'block_rows': block_rows, 'padded_columns': padded_columns, 'block_size': block_size, 'row_pitch': row_pitch, 'block_start': block_start, 'selector_id': selector_id, 'selector_address': selector_address, 'allocation': allocation, 'block_valid_texels': block_valid_texels}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 0, 'selector_address': 16, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 9, 'selector_address': 25, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 147, 'selector_id': 0, 'selector_address': 152, 'allocation': 153, 'block_valid_texels': 4}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 266, 'selector_id': 7, 'selector_address': 278, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 283, 'selector_id': 8, 'selector_address': 296, 'allocation': 408, 'block_valid_texels': 6}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 215, 'selector_id': 3, 'selector_address': 223, 'allocation': 255, 'block_valid_texels': 4})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 0, 'selector_address': 27, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 9, 'selector_address': 36, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 158, 'selector_id': 0, 'selector_address': 163, 'allocation': 153, 'block_valid_texels': 9}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 277, 'selector_id': 7, 'selector_address': 289, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 294, 'selector_id': 8, 'selector_address': 307, 'allocation': 408, 'block_valid_texels': 9}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 226, 'selector_id': 3, 'selector_address': 234, 'allocation': 255, 'block_valid_texels': 4})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 0, 'selector_address': 38, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 9, 'selector_address': 47, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 4, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 169, 'selector_id': 0, 'selector_address': 174, 'allocation': 204, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 288, 'selector_id': 7, 'selector_address': 300, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 305, 'selector_id': 8, 'selector_address': 318, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 237, 'selector_id': 3, 'selector_address': 245, 'allocation': 255, 'block_valid_texels': 4})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 0, 'selector_address': 49, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 9, 'selector_address': 58, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 282, 'selector_id': 0, 'selector_address': 287, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 299, 'selector_id': 7, 'selector_address': 311, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 316, 'selector_id': 8, 'selector_address': 329, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 248, 'selector_id': 3, 'selector_address': 256, 'allocation': 255, 'block_valid_texels': 4})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 0, 'selector_address': 60, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 9, 'selector_address': 69, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 293, 'selector_id': 0, 'selector_address': 298, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 310, 'selector_id': 7, 'selector_address': 322, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 327, 'selector_id': 8, 'selector_address': 340, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 259, 'selector_id': 3, 'selector_address': 267, 'allocation': 255, 'block_valid_texels': 4})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The returned physical layout descriptor disagrees with the declared buffer mapping at padded_columns.

A stipulated 4x3 block format stores 5 endpoint bytes followed by twelve one-byte texel selectors. Block rows are padded to a multiple of three blocks; selector lookup never decodes colors. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    block_columns = (p["w"]+3)//4
    block_rows = (p["h"]+2)//3
    padded_columns = ((block_columns+2)//3)*3
    block_size = p["endpoints"]*12
    row_pitch = padded_columns*block_size
    block_start = p["base"]+(p["y"]//3)*row_pitch+(p["x"]//4)*block_size
    selector_id = (p["y"]%3)*4+p["x"]%4
    selector_address = block_start+p["endpoints"]+selector_id
    allocation = row_pitch*block_rows
    block_valid_texels = min(4,p["w"]-(p["x"]//4)*4)*min(3,p["h"]-(p["y"]//3)*3)
    return {'block_columns': block_columns, 'block_rows': block_rows, 'padded_columns': padded_columns, 'block_size': block_size, 'row_pitch': row_pitch, 'block_start': block_start, 'selector_id': selector_id, 'selector_address': selector_address, 'allocation': allocation, 'block_valid_texels': block_valid_texels}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 0, 'selector_address': 16, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 9, 'selector_address': 25, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 147, 'selector_id': 0, 'selector_address': 152, 'allocation': 153, 'block_valid_texels': 4}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 266, 'selector_id': 7, 'selector_address': 278, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 283, 'selector_id': 8, 'selector_address': 296, 'allocation': 408, 'block_valid_texels': 6}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 215, 'selector_id': 3, 'selector_address': 223, 'allocation': 255, 'block_valid_texels': 4})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 0, 'selector_address': 27, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 9, 'selector_address': 36, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 158, 'selector_id': 0, 'selector_address': 163, 'allocation': 153, 'block_valid_texels': 9}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 277, 'selector_id': 7, 'selector_address': 289, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 294, 'selector_id': 8, 'selector_address': 307, 'allocation': 408, 'block_valid_texels': 9}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 226, 'selector_id': 3, 'selector_address': 234, 'allocation': 255, 'block_valid_texels': 4})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 0, 'selector_address': 38, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 9, 'selector_address': 47, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 4, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 169, 'selector_id': 0, 'selector_address': 174, 'allocation': 204, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 288, 'selector_id': 7, 'selector_address': 300, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 305, 'selector_id': 8, 'selector_address': 318, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 237, 'selector_id': 3, 'selector_address': 245, 'allocation': 255, 'block_valid_texels': 4})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 0, 'selector_address': 49, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 9, 'selector_address': 58, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 282, 'selector_id': 0, 'selector_address': 287, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 299, 'selector_id': 7, 'selector_address': 311, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 316, 'selector_id': 8, 'selector_address': 329, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 248, 'selector_id': 3, 'selector_address': 256, 'allocation': 255, 'block_valid_texels': 4})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 0, 'selector_address': 60, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 9, 'selector_address': 69, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 293, 'selector_id': 0, 'selector_address': 298, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 310, 'selector_id': 7, 'selector_address': 322, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 327, 'selector_id': 8, 'selector_address': 340, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 259, 'selector_id': 3, 'selector_address': 267, 'allocation': 255, 'block_valid_texels': 4})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    block_columns = (p["w"]+3)//4
    block_rows = (p["h"]+2)//3
    padded_columns = ((block_columns+2)//3)*3
    block_size = 12
    row_pitch = padded_columns*block_size
    block_start = p["base"]+(p["y"]//3)*row_pitch+(p["x"]//4)*block_size
    selector_id = (p["y"]%3)*4+p["x"]%4
    selector_address = block_start+p["endpoints"]+selector_id
    allocation = row_pitch*block_rows
    block_valid_texels = min(4,p["w"]-(p["x"]//4)*4)*min(3,p["h"]-(p["y"]//3)*3)
    return {'block_columns': block_columns, 'block_rows': block_rows, 'padded_columns': padded_columns, 'block_size': block_size, 'row_pitch': row_pitch, 'block_start': block_start, 'selector_id': selector_id, 'selector_address': selector_address, 'allocation': allocation, 'block_valid_texels': block_valid_texels}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 0, 'selector_address': 16, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 9, 'selector_address': 25, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 147, 'selector_id': 0, 'selector_address': 152, 'allocation': 153, 'block_valid_texels': 4}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 266, 'selector_id': 7, 'selector_address': 278, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 283, 'selector_id': 8, 'selector_address': 296, 'allocation': 408, 'block_valid_texels': 6}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 215, 'selector_id': 3, 'selector_address': 223, 'allocation': 255, 'block_valid_texels': 4})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 0, 'selector_address': 27, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 9, 'selector_address': 36, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 158, 'selector_id': 0, 'selector_address': 163, 'allocation': 153, 'block_valid_texels': 9}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 277, 'selector_id': 7, 'selector_address': 289, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 294, 'selector_id': 8, 'selector_address': 307, 'allocation': 408, 'block_valid_texels': 9}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 226, 'selector_id': 3, 'selector_address': 234, 'allocation': 255, 'block_valid_texels': 4})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 0, 'selector_address': 38, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 9, 'selector_address': 47, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 4, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 169, 'selector_id': 0, 'selector_address': 174, 'allocation': 204, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 288, 'selector_id': 7, 'selector_address': 300, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 305, 'selector_id': 8, 'selector_address': 318, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 237, 'selector_id': 3, 'selector_address': 245, 'allocation': 255, 'block_valid_texels': 4})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 0, 'selector_address': 49, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 9, 'selector_address': 58, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 282, 'selector_id': 0, 'selector_address': 287, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 299, 'selector_id': 7, 'selector_address': 311, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 316, 'selector_id': 8, 'selector_address': 329, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 248, 'selector_id': 3, 'selector_address': 256, 'allocation': 255, 'block_valid_texels': 4})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 0, 'selector_address': 60, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 9, 'selector_address': 69, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 293, 'selector_id': 0, 'selector_address': 298, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 310, 'selector_id': 7, 'selector_address': 322, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 327, 'selector_id': 8, 'selector_address': 340, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 259, 'selector_id': 3, 'selector_address': 267, 'allocation': 255, 'block_valid_texels': 4})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The returned physical layout descriptor disagrees with the declared buffer mapping at block_size.

A stipulated 4x3 block format stores 5 endpoint bytes followed by twelve one-byte texel selectors. Block rows are padded to a multiple of three blocks; selector lookup never decodes colors. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    block_columns = (p["w"]+3)//4
    block_rows = (p["h"]+2)//3
    padded_columns = ((block_columns+2)//3)*3
    block_size = p["endpoints"]+12
    row_pitch = block_columns*block_size
    block_start = p["base"]+(p["y"]//3)*row_pitch+(p["x"]//4)*block_size
    selector_id = (p["y"]%3)*4+p["x"]%4
    selector_address = block_start+p["endpoints"]+selector_id
    allocation = row_pitch*block_rows
    block_valid_texels = min(4,p["w"]-(p["x"]//4)*4)*min(3,p["h"]-(p["y"]//3)*3)
    return {'block_columns': block_columns, 'block_rows': block_rows, 'padded_columns': padded_columns, 'block_size': block_size, 'row_pitch': row_pitch, 'block_start': block_start, 'selector_id': selector_id, 'selector_address': selector_address, 'allocation': allocation, 'block_valid_texels': block_valid_texels}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 0, 'selector_address': 16, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 9, 'selector_address': 25, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 147, 'selector_id': 0, 'selector_address': 152, 'allocation': 153, 'block_valid_texels': 4}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 266, 'selector_id': 7, 'selector_address': 278, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 283, 'selector_id': 8, 'selector_address': 296, 'allocation': 408, 'block_valid_texels': 6}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 215, 'selector_id': 3, 'selector_address': 223, 'allocation': 255, 'block_valid_texels': 4})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 0, 'selector_address': 27, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 9, 'selector_address': 36, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 158, 'selector_id': 0, 'selector_address': 163, 'allocation': 153, 'block_valid_texels': 9}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 277, 'selector_id': 7, 'selector_address': 289, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 294, 'selector_id': 8, 'selector_address': 307, 'allocation': 408, 'block_valid_texels': 9}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 226, 'selector_id': 3, 'selector_address': 234, 'allocation': 255, 'block_valid_texels': 4})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 0, 'selector_address': 38, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 9, 'selector_address': 47, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 4, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 169, 'selector_id': 0, 'selector_address': 174, 'allocation': 204, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 288, 'selector_id': 7, 'selector_address': 300, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 305, 'selector_id': 8, 'selector_address': 318, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 237, 'selector_id': 3, 'selector_address': 245, 'allocation': 255, 'block_valid_texels': 4})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 0, 'selector_address': 49, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 9, 'selector_address': 58, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 282, 'selector_id': 0, 'selector_address': 287, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 299, 'selector_id': 7, 'selector_address': 311, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 316, 'selector_id': 8, 'selector_address': 329, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 248, 'selector_id': 3, 'selector_address': 256, 'allocation': 255, 'block_valid_texels': 4})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 0, 'selector_address': 60, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 9, 'selector_address': 69, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 293, 'selector_id': 0, 'selector_address': 298, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 310, 'selector_id': 7, 'selector_address': 322, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 327, 'selector_id': 8, 'selector_address': 340, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 259, 'selector_id': 3, 'selector_address': 267, 'allocation': 255, 'block_valid_texels': 4})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    block_columns = (p["w"]+3)//4
    block_rows = (p["h"]+2)//3
    padded_columns = ((block_columns+2)//3)*3
    block_size = p["endpoints"]+12
    row_pitch = padded_columns*12
    block_start = p["base"]+(p["y"]//3)*row_pitch+(p["x"]//4)*block_size
    selector_id = (p["y"]%3)*4+p["x"]%4
    selector_address = block_start+p["endpoints"]+selector_id
    allocation = row_pitch*block_rows
    block_valid_texels = min(4,p["w"]-(p["x"]//4)*4)*min(3,p["h"]-(p["y"]//3)*3)
    return {'block_columns': block_columns, 'block_rows': block_rows, 'padded_columns': padded_columns, 'block_size': block_size, 'row_pitch': row_pitch, 'block_start': block_start, 'selector_id': selector_id, 'selector_address': selector_address, 'allocation': allocation, 'block_valid_texels': block_valid_texels}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 0, 'selector_address': 16, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 9, 'selector_address': 25, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 147, 'selector_id': 0, 'selector_address': 152, 'allocation': 153, 'block_valid_texels': 4}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 266, 'selector_id': 7, 'selector_address': 278, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 283, 'selector_id': 8, 'selector_address': 296, 'allocation': 408, 'block_valid_texels': 6}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 215, 'selector_id': 3, 'selector_address': 223, 'allocation': 255, 'block_valid_texels': 4})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 0, 'selector_address': 27, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 9, 'selector_address': 36, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 158, 'selector_id': 0, 'selector_address': 163, 'allocation': 153, 'block_valid_texels': 9}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 277, 'selector_id': 7, 'selector_address': 289, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 294, 'selector_id': 8, 'selector_address': 307, 'allocation': 408, 'block_valid_texels': 9}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 226, 'selector_id': 3, 'selector_address': 234, 'allocation': 255, 'block_valid_texels': 4})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 0, 'selector_address': 38, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 9, 'selector_address': 47, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 4, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 169, 'selector_id': 0, 'selector_address': 174, 'allocation': 204, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 288, 'selector_id': 7, 'selector_address': 300, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 305, 'selector_id': 8, 'selector_address': 318, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 237, 'selector_id': 3, 'selector_address': 245, 'allocation': 255, 'block_valid_texels': 4})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 0, 'selector_address': 49, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 9, 'selector_address': 58, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 282, 'selector_id': 0, 'selector_address': 287, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 299, 'selector_id': 7, 'selector_address': 311, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 316, 'selector_id': 8, 'selector_address': 329, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 248, 'selector_id': 3, 'selector_address': 256, 'allocation': 255, 'block_valid_texels': 4})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 0, 'selector_address': 60, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 9, 'selector_address': 69, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 293, 'selector_id': 0, 'selector_address': 298, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 310, 'selector_id': 7, 'selector_address': 322, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 327, 'selector_id': 8, 'selector_address': 340, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 259, 'selector_id': 3, 'selector_address': 267, 'allocation': 255, 'block_valid_texels': 4})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The returned physical layout descriptor disagrees with the declared buffer mapping at row_pitch.

A stipulated 4x3 block format stores 5 endpoint bytes followed by twelve one-byte texel selectors. Block rows are padded to a multiple of three blocks; selector lookup never decodes colors. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    block_columns = (p["w"]+3)//4
    block_rows = (p["h"]+2)//3
    padded_columns = ((block_columns+2)//3)*3
    block_size = p["endpoints"]+12
    row_pitch = padded_columns*block_size
    block_start = p["base"]+(p["y"]//3)*row_pitch+p["x"]*block_size
    selector_id = (p["y"]%3)*4+p["x"]%4
    selector_address = block_start+p["endpoints"]+selector_id
    allocation = row_pitch*block_rows
    block_valid_texels = min(4,p["w"]-(p["x"]//4)*4)*min(3,p["h"]-(p["y"]//3)*3)
    return {'block_columns': block_columns, 'block_rows': block_rows, 'padded_columns': padded_columns, 'block_size': block_size, 'row_pitch': row_pitch, 'block_start': block_start, 'selector_id': selector_id, 'selector_address': selector_address, 'allocation': allocation, 'block_valid_texels': block_valid_texels}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 0, 'selector_address': 16, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 9, 'selector_address': 25, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 147, 'selector_id': 0, 'selector_address': 152, 'allocation': 153, 'block_valid_texels': 4}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 266, 'selector_id': 7, 'selector_address': 278, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 283, 'selector_id': 8, 'selector_address': 296, 'allocation': 408, 'block_valid_texels': 6}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 215, 'selector_id': 3, 'selector_address': 223, 'allocation': 255, 'block_valid_texels': 4})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 0, 'selector_address': 27, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 9, 'selector_address': 36, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 158, 'selector_id': 0, 'selector_address': 163, 'allocation': 153, 'block_valid_texels': 9}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 277, 'selector_id': 7, 'selector_address': 289, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 294, 'selector_id': 8, 'selector_address': 307, 'allocation': 408, 'block_valid_texels': 9}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 226, 'selector_id': 3, 'selector_address': 234, 'allocation': 255, 'block_valid_texels': 4})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 0, 'selector_address': 38, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 9, 'selector_address': 47, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 4, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 169, 'selector_id': 0, 'selector_address': 174, 'allocation': 204, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 288, 'selector_id': 7, 'selector_address': 300, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 305, 'selector_id': 8, 'selector_address': 318, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 237, 'selector_id': 3, 'selector_address': 245, 'allocation': 255, 'block_valid_texels': 4})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 0, 'selector_address': 49, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 9, 'selector_address': 58, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 282, 'selector_id': 0, 'selector_address': 287, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 299, 'selector_id': 7, 'selector_address': 311, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 316, 'selector_id': 8, 'selector_address': 329, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 248, 'selector_id': 3, 'selector_address': 256, 'allocation': 255, 'block_valid_texels': 4})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 0, 'selector_address': 60, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 9, 'selector_address': 69, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 293, 'selector_id': 0, 'selector_address': 298, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 310, 'selector_id': 7, 'selector_address': 322, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 327, 'selector_id': 8, 'selector_address': 340, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 259, 'selector_id': 3, 'selector_address': 267, 'allocation': 255, 'block_valid_texels': 4})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    block_columns = (p["w"]+3)//4
    block_rows = (p["h"]+2)//3
    padded_columns = ((block_columns+2)//3)*3
    block_size = p["endpoints"]+12
    row_pitch = padded_columns*block_size
    block_start = p["base"]+p["y"]*row_pitch+(p["x"]//4)*block_size
    selector_id = (p["y"]%3)*4+p["x"]%4
    selector_address = block_start+p["endpoints"]+selector_id
    allocation = row_pitch*block_rows
    block_valid_texels = min(4,p["w"]-(p["x"]//4)*4)*min(3,p["h"]-(p["y"]//3)*3)
    return {'block_columns': block_columns, 'block_rows': block_rows, 'padded_columns': padded_columns, 'block_size': block_size, 'row_pitch': row_pitch, 'block_start': block_start, 'selector_id': selector_id, 'selector_address': selector_address, 'allocation': allocation, 'block_valid_texels': block_valid_texels}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 0, 'selector_address': 16, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 11, 'selector_id': 9, 'selector_address': 25, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 147, 'selector_id': 0, 'selector_address': 152, 'allocation': 153, 'block_valid_texels': 4}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 266, 'selector_id': 7, 'selector_address': 278, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 283, 'selector_id': 8, 'selector_address': 296, 'allocation': 408, 'block_valid_texels': 6}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 215, 'selector_id': 3, 'selector_address': 223, 'allocation': 255, 'block_valid_texels': 4})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 0, 'selector_address': 27, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 22, 'selector_id': 9, 'selector_address': 36, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 158, 'selector_id': 0, 'selector_address': 163, 'allocation': 153, 'block_valid_texels': 9}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 277, 'selector_id': 7, 'selector_address': 289, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 294, 'selector_id': 8, 'selector_address': 307, 'allocation': 408, 'block_valid_texels': 9}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 226, 'selector_id': 3, 'selector_address': 234, 'allocation': 255, 'block_valid_texels': 4})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 0, 'selector_address': 38, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 2, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 33, 'selector_id': 9, 'selector_address': 47, 'allocation': 102, 'block_valid_texels': 12}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 4, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 169, 'selector_id': 0, 'selector_address': 174, 'allocation': 204, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 288, 'selector_id': 7, 'selector_address': 300, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 5, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 305, 'selector_id': 8, 'selector_address': 318, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 237, 'selector_id': 3, 'selector_address': 245, 'allocation': 255, 'block_valid_texels': 4})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 0, 'selector_address': 49, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 44, 'selector_id': 9, 'selector_address': 58, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 282, 'selector_id': 0, 'selector_address': 287, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 299, 'selector_id': 7, 'selector_address': 311, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 316, 'selector_id': 8, 'selector_address': 329, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 248, 'selector_id': 3, 'selector_address': 256, 'allocation': 255, 'block_valid_texels': 4})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 1, 'block_rows': 1, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 0, 'selector_address': 60, 'allocation': 51, 'block_valid_texels': 1}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 3, 'block_rows': 3, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 55, 'selector_id': 9, 'selector_address': 69, 'allocation': 153, 'block_valid_texels': 12}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 4, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 293, 'selector_id': 0, 'selector_address': 298, 'allocation': 408, 'block_valid_texels': 12}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 4, 'block_rows': 3, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 310, 'selector_id': 7, 'selector_address': 322, 'allocation': 306, 'block_valid_texels': 8}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 6, 'block_rows': 5, 'padded_columns': 6, 'block_size': 17, 'row_pitch': 102, 'block_start': 327, 'selector_id': 8, 'selector_address': 340, 'allocation': 510, 'block_valid_texels': 12}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55, 'endpoints': 5}, {'block_columns': 2, 'block_rows': 5, 'padded_columns': 3, 'block_size': 17, 'row_pitch': 51, 'block_start': 259, 'selector_id': 3, 'selector_address': 267, 'allocation': 255, 'block_valid_texels': 4})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The returned physical layout descriptor disagrees with the declared buffer mapping at block_start.

A stipulated 4x3 block format stores 5 endpoint bytes followed by twelve one-byte texel selectors. Block rows are padded to a multiple of three blocks; selector lookup never decodes colors. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access