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

N = 1
observations = []
def solve(p):
    p = dict(p)
    tile_columns = (p["w"]+7)//8
    tile_x = p["x"]//4
    tile_y = p["y"]//4
    bank = (p["x"]%4)^(p["y"]%4)
    bank_local = (p["y"]%4)*2+(p["x"]%8)//4
    bank_pitch = 8*p["b"]+1
    tile_pitch = 4*bank_pitch
    tile_row_pitch = tile_columns*tile_pitch+7
    tile_origin = p["base"]+tile_y*tile_row_pitch+tile_x*tile_pitch
    address = tile_origin+bank*bank_pitch+1+bank_local*p["b"]
    return {'tile_columns': tile_columns, 'tile_x': tile_x, 'tile_y': tile_y, 'bank': bank, 'bank_local': bank_local, 'bank_pitch': bank_pitch, 'tile_pitch': tile_pitch, 'tile_row_pitch': tile_row_pitch, 'tile_origin': tile_origin, 'address': address}
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}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 12}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 71}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 265}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 237}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 211, 'tile_origin': 569, 'address': 570}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 236, 'address': 288})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 23}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 110}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 392}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 351}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 307, 'tile_origin': 836, 'address': 837}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 343, 'address': 419})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 34}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 149}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 519}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 465}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 403, 'tile_origin': 1103, 'address': 1104}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 450, 'address': 550})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 44, 'address': 45}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 44, 'address': 188}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 646}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 579}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 499, 'tile_origin': 1370, 'address': 1371}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 557, 'address': 681})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 55, 'address': 56}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 55, 'address': 227}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 773}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 693}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 595, 'tile_origin': 1637, 'address': 1638}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 664, 'address': 812})]}
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)
    tile_columns = (p["w"]+7)//8
    tile_x = p["x"]%8
    tile_y = p["y"]//4
    bank = (p["x"]%4)^(p["y"]%4)
    bank_local = (p["y"]%4)*2+(p["x"]%8)//4
    bank_pitch = 8*p["b"]+1
    tile_pitch = 4*bank_pitch
    tile_row_pitch = tile_columns*tile_pitch+7
    tile_origin = p["base"]+tile_y*tile_row_pitch+tile_x*tile_pitch
    address = tile_origin+bank*bank_pitch+1+bank_local*p["b"]
    return {'tile_columns': tile_columns, 'tile_x': tile_x, 'tile_y': tile_y, 'bank': bank, 'bank_local': bank_local, 'bank_pitch': bank_pitch, 'tile_pitch': tile_pitch, 'tile_row_pitch': tile_row_pitch, 'tile_origin': tile_origin, 'address': address}
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}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 12}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 71}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 265}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 237}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 211, 'tile_origin': 569, 'address': 570}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 236, 'address': 288})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 23}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 110}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 392}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 351}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 307, 'tile_origin': 836, 'address': 837}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 343, 'address': 419})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 34}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 149}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 519}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 465}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 403, 'tile_origin': 1103, 'address': 1104}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 450, 'address': 550})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 44, 'address': 45}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 44, 'address': 188}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 646}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 579}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 499, 'tile_origin': 1370, 'address': 1371}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 557, 'address': 681})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 55, 'address': 56}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 55, 'address': 227}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 773}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 693}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 595, 'tile_origin': 1637, 'address': 1638}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 664, 'address': 812})]}
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 tile_x.

A stipulated 8x4 tile has four banks. Bank = (local x modulo 4) XOR (local y modulo 4); each bank stores two columns per row and begins with a one-byte tag. Tile rows include a seven-byte trailer. 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)
    tile_columns = (p["w"]+7)//8
    tile_x = p["x"]//8
    tile_y = p["y"]%4
    bank = (p["x"]%4)^(p["y"]%4)
    bank_local = (p["y"]%4)*2+(p["x"]%8)//4
    bank_pitch = 8*p["b"]+1
    tile_pitch = 4*bank_pitch
    tile_row_pitch = tile_columns*tile_pitch+7
    tile_origin = p["base"]+tile_y*tile_row_pitch+tile_x*tile_pitch
    address = tile_origin+bank*bank_pitch+1+bank_local*p["b"]
    return {'tile_columns': tile_columns, 'tile_x': tile_x, 'tile_y': tile_y, 'bank': bank, 'bank_local': bank_local, 'bank_pitch': bank_pitch, 'tile_pitch': tile_pitch, 'tile_row_pitch': tile_row_pitch, 'tile_origin': tile_origin, 'address': address}
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}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 12}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 71}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 265}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 237}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 211, 'tile_origin': 569, 'address': 570}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 236, 'address': 288})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 23}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 110}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 392}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 351}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 307, 'tile_origin': 836, 'address': 837}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 343, 'address': 419})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 34}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 149}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 519}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 465}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 403, 'tile_origin': 1103, 'address': 1104}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 450, 'address': 550})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 44, 'address': 45}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 44, 'address': 188}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 646}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 579}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 499, 'tile_origin': 1370, 'address': 1371}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 557, 'address': 681})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 55, 'address': 56}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 55, 'address': 227}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 773}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 693}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 595, 'tile_origin': 1637, 'address': 1638}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 664, 'address': 812})]}
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)
    tile_columns = (p["w"]+7)//8
    tile_x = p["x"]//8
    tile_y = p["y"]//8
    bank = (p["x"]%4)^(p["y"]%4)
    bank_local = (p["y"]%4)*2+(p["x"]%8)//4
    bank_pitch = 8*p["b"]+1
    tile_pitch = 4*bank_pitch
    tile_row_pitch = tile_columns*tile_pitch+7
    tile_origin = p["base"]+tile_y*tile_row_pitch+tile_x*tile_pitch
    address = tile_origin+bank*bank_pitch+1+bank_local*p["b"]
    return {'tile_columns': tile_columns, 'tile_x': tile_x, 'tile_y': tile_y, 'bank': bank, 'bank_local': bank_local, 'bank_pitch': bank_pitch, 'tile_pitch': tile_pitch, 'tile_row_pitch': tile_row_pitch, 'tile_origin': tile_origin, 'address': address}
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}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 12}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 71}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 265}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 237}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 211, 'tile_origin': 569, 'address': 570}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 236, 'address': 288})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 23}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 110}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 392}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 351}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 307, 'tile_origin': 836, 'address': 837}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 343, 'address': 419})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 34}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 149}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 519}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 465}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 403, 'tile_origin': 1103, 'address': 1104}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 450, 'address': 550})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 44, 'address': 45}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 44, 'address': 188}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 646}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 579}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 499, 'tile_origin': 1370, 'address': 1371}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 557, 'address': 681})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 55, 'address': 56}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 55, 'address': 227}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 773}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 693}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 595, 'tile_origin': 1637, 'address': 1638}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 664, 'address': 812})]}
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 tile_y.

A stipulated 8x4 tile has four banks. Bank = (local x modulo 4) XOR (local y modulo 4); each bank stores two columns per row and begins with a one-byte tag. Tile rows include a seven-byte trailer. 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)
    tile_columns = (p["w"]+7)//8
    tile_x = p["x"]//8
    tile_y = p["y"]//4
    bank = p["x"]%4
    bank_local = (p["y"]%4)*2+(p["x"]%8)//4
    bank_pitch = 8*p["b"]+1
    tile_pitch = 4*bank_pitch
    tile_row_pitch = tile_columns*tile_pitch+7
    tile_origin = p["base"]+tile_y*tile_row_pitch+tile_x*tile_pitch
    address = tile_origin+bank*bank_pitch+1+bank_local*p["b"]
    return {'tile_columns': tile_columns, 'tile_x': tile_x, 'tile_y': tile_y, 'bank': bank, 'bank_local': bank_local, 'bank_pitch': bank_pitch, 'tile_pitch': tile_pitch, 'tile_row_pitch': tile_row_pitch, 'tile_origin': tile_origin, 'address': address}
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}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 12}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 71}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 265}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 237}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 211, 'tile_origin': 569, 'address': 570}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 236, 'address': 288})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 23}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 110}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 392}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 351}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 307, 'tile_origin': 836, 'address': 837}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 343, 'address': 419})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 34}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 149}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 519}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 465}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 403, 'tile_origin': 1103, 'address': 1104}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 450, 'address': 550})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 44, 'address': 45}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 44, 'address': 188}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 646}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 579}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 499, 'tile_origin': 1370, 'address': 1371}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 557, 'address': 681})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 55, 'address': 56}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 55, 'address': 227}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 773}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 693}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 595, 'tile_origin': 1637, 'address': 1638}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 664, 'address': 812})]}
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)
    tile_columns = (p["w"]+7)//8
    tile_x = p["x"]//8
    tile_y = p["y"]//4
    bank = (p["x"]%4+p["y"]%4)%4
    bank_local = (p["y"]%4)*2+(p["x"]%8)//4
    bank_pitch = 8*p["b"]+1
    tile_pitch = 4*bank_pitch
    tile_row_pitch = tile_columns*tile_pitch+7
    tile_origin = p["base"]+tile_y*tile_row_pitch+tile_x*tile_pitch
    address = tile_origin+bank*bank_pitch+1+bank_local*p["b"]
    return {'tile_columns': tile_columns, 'tile_x': tile_x, 'tile_y': tile_y, 'bank': bank, 'bank_local': bank_local, 'bank_pitch': bank_pitch, 'tile_pitch': tile_pitch, 'tile_row_pitch': tile_row_pitch, 'tile_origin': tile_origin, 'address': address}
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}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 12}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 71}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 265}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 237}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 211, 'tile_origin': 569, 'address': 570}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 236, 'address': 288})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 23}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 110}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 392}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 351}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 307, 'tile_origin': 836, 'address': 837}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 343, 'address': 419})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 34}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 149}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 519}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 465}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 403, 'tile_origin': 1103, 'address': 1104}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 450, 'address': 550})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 44, 'address': 45}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 44, 'address': 188}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 646}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 579}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 499, 'tile_origin': 1370, 'address': 1371}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 557, 'address': 681})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 55, 'address': 56}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 55, 'address': 227}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 773}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 693}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 595, 'tile_origin': 1637, 'address': 1638}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 664, 'address': 812})]}
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 bank.

A stipulated 8x4 tile has four banks. Bank = (local x modulo 4) XOR (local y modulo 4); each bank stores two columns per row and begins with a one-byte tag. Tile rows include a seven-byte trailer. 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)
    tile_columns = (p["w"]+7)//8
    tile_x = p["x"]//8
    tile_y = p["y"]//4
    bank = (p["x"]%4)^(p["y"]%4)
    bank_local = (p["y"]%4)*2+p["x"]%2
    bank_pitch = 8*p["b"]+1
    tile_pitch = 4*bank_pitch
    tile_row_pitch = tile_columns*tile_pitch+7
    tile_origin = p["base"]+tile_y*tile_row_pitch+tile_x*tile_pitch
    address = tile_origin+bank*bank_pitch+1+bank_local*p["b"]
    return {'tile_columns': tile_columns, 'tile_x': tile_x, 'tile_y': tile_y, 'bank': bank, 'bank_local': bank_local, 'bank_pitch': bank_pitch, 'tile_pitch': tile_pitch, 'tile_row_pitch': tile_row_pitch, 'tile_origin': tile_origin, 'address': address}
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}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 12}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 71}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 265}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 237}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 211, 'tile_origin': 569, 'address': 570}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 236, 'address': 288})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 23}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 110}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 392}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 351}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 307, 'tile_origin': 836, 'address': 837}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 343, 'address': 419})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 34}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 149}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 519}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 465}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 403, 'tile_origin': 1103, 'address': 1104}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 450, 'address': 550})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 44, 'address': 45}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 44, 'address': 188}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 646}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 579}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 499, 'tile_origin': 1370, 'address': 1371}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 557, 'address': 681})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 55, 'address': 56}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 55, 'address': 227}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 773}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 693}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 595, 'tile_origin': 1637, 'address': 1638}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 664, 'address': 812})]}
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)
    tile_columns = (p["w"]+7)//8
    tile_x = p["x"]//8
    tile_y = p["y"]//4
    bank = (p["x"]%4)^(p["y"]%4)
    bank_local = ((p["x"]%8)//4)*4+p["y"]%4
    bank_pitch = 8*p["b"]+1
    tile_pitch = 4*bank_pitch
    tile_row_pitch = tile_columns*tile_pitch+7
    tile_origin = p["base"]+tile_y*tile_row_pitch+tile_x*tile_pitch
    address = tile_origin+bank*bank_pitch+1+bank_local*p["b"]
    return {'tile_columns': tile_columns, 'tile_x': tile_x, 'tile_y': tile_y, 'bank': bank, 'bank_local': bank_local, 'bank_pitch': bank_pitch, 'tile_pitch': tile_pitch, 'tile_row_pitch': tile_row_pitch, 'tile_origin': tile_origin, 'address': address}
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}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 12}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 71}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 265}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 237}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 211, 'tile_origin': 569, 'address': 570}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 236, 'address': 288})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 23}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 110}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 392}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 351}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 307, 'tile_origin': 836, 'address': 837}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 343, 'address': 419})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 34}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 149}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 519}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 465}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 403, 'tile_origin': 1103, 'address': 1104}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 450, 'address': 550})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 44, 'address': 45}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 44, 'address': 188}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 646}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 579}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 499, 'tile_origin': 1370, 'address': 1371}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 557, 'address': 681})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 55, 'address': 56}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 55, 'address': 227}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 773}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 693}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 595, 'tile_origin': 1637, 'address': 1638}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 664, 'address': 812})]}
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 bank_local.

A stipulated 8x4 tile has four banks. Bank = (local x modulo 4) XOR (local y modulo 4); each bank stores two columns per row and begins with a one-byte tag. Tile rows include a seven-byte trailer. 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)
    tile_columns = (p["w"]+7)//8
    tile_x = p["x"]//8
    tile_y = p["y"]//4
    bank = (p["x"]%4)^(p["y"]%4)
    bank_local = (p["y"]%4)*2+(p["x"]%8)//4
    bank_pitch = 8*p["b"]
    tile_pitch = 4*bank_pitch
    tile_row_pitch = tile_columns*tile_pitch+7
    tile_origin = p["base"]+tile_y*tile_row_pitch+tile_x*tile_pitch
    address = tile_origin+bank*bank_pitch+1+bank_local*p["b"]
    return {'tile_columns': tile_columns, 'tile_x': tile_x, 'tile_y': tile_y, 'bank': bank, 'bank_local': bank_local, 'bank_pitch': bank_pitch, 'tile_pitch': tile_pitch, 'tile_row_pitch': tile_row_pitch, 'tile_origin': tile_origin, 'address': address}
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}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 12}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 71}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 265}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 237}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 211, 'tile_origin': 569, 'address': 570}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 236, 'address': 288})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 23}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 110}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 392}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 351}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 307, 'tile_origin': 836, 'address': 837}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 343, 'address': 419})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 34}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 149}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 519}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 465}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 403, 'tile_origin': 1103, 'address': 1104}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 450, 'address': 550})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 44, 'address': 45}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 44, 'address': 188}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 646}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 579}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 499, 'tile_origin': 1370, 'address': 1371}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 557, 'address': 681})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 55, 'address': 56}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 55, 'address': 227}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 773}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 693}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 595, 'tile_origin': 1637, 'address': 1638}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 664, 'address': 812})]}
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)
    tile_columns = (p["w"]+7)//8
    tile_x = p["x"]//8
    tile_y = p["y"]//4
    bank = (p["x"]%4)^(p["y"]%4)
    bank_local = (p["y"]%4)*2+(p["x"]%8)//4
    bank_pitch = (8+1)*p["b"]
    tile_pitch = 4*bank_pitch
    tile_row_pitch = tile_columns*tile_pitch+7
    tile_origin = p["base"]+tile_y*tile_row_pitch+tile_x*tile_pitch
    address = tile_origin+bank*bank_pitch+1+bank_local*p["b"]
    return {'tile_columns': tile_columns, 'tile_x': tile_x, 'tile_y': tile_y, 'bank': bank, 'bank_local': bank_local, 'bank_pitch': bank_pitch, 'tile_pitch': tile_pitch, 'tile_row_pitch': tile_row_pitch, 'tile_origin': tile_origin, 'address': address}
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}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 12}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 11, 'address': 71}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 265}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 143, 'tile_origin': 222, 'address': 237}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 211, 'tile_origin': 569, 'address': 570}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 17, 'tile_pitch': 68, 'tile_row_pitch': 75, 'tile_origin': 236, 'address': 288})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 23}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 22, 'address': 110}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 392}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 207, 'tile_origin': 329, 'address': 351}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 307, 'tile_origin': 836, 'address': 837}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 25, 'tile_pitch': 100, 'tile_row_pitch': 107, 'tile_origin': 343, 'address': 419})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 34}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 33, 'address': 149}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 519}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 271, 'tile_origin': 436, 'address': 465}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 403, 'tile_origin': 1103, 'address': 1104}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 33, 'tile_pitch': 132, 'tile_row_pitch': 139, 'tile_origin': 450, 'address': 550})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 44, 'address': 45}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 44, 'address': 188}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 646}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 335, 'tile_origin': 543, 'address': 579}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 499, 'tile_origin': 1370, 'address': 1371}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 41, 'tile_pitch': 164, 'tile_row_pitch': 171, 'tile_origin': 557, 'address': 681})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 0, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 55, 'address': 56}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 0, 'tile_y': 0, 'bank': 3, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 55, 'address': 227}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 2, 'bank_local': 4, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 773}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'tile_columns': 2, 'tile_x': 1, 'tile_y': 1, 'bank': 0, 'bank_local': 7, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 399, 'tile_origin': 650, 'address': 693}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'tile_columns': 3, 'tile_x': 2, 'tile_y': 2, 'bank': 0, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 595, 'tile_origin': 1637, 'address': 1638}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'tile_columns': 1, 'tile_x': 0, 'tile_y': 3, 'bank': 3, 'bank_local': 0, 'bank_pitch': 49, 'tile_pitch': 196, 'tile_row_pitch': 203, 'tile_origin': 664, 'address': 812})]}
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 bank_pitch.

A stipulated 8x4 tile has four banks. Bank = (local x modulo 4) XOR (local y modulo 4); each bank stores two columns per row and begins with a one-byte tag. Tile rows include a seven-byte trailer. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access