search challenge: triangle marker on a crate's back face (rendered in vision, in digest), report tool with distance verification, smooth turn(duration), --free/--search autonomous modes, look_at crates; verified with gpt-5.6-luna
This commit is contained in:
@@ -131,3 +131,51 @@ def test_describe_layout():
|
||||
assert d["room"]["width"] == ROOM_SIZE
|
||||
assert len(d["obstacles"]) == 3
|
||||
assert d["beacon"]["id"] == "beacon"
|
||||
|
||||
|
||||
def test_marker_is_on_a_back_face():
|
||||
"""The triangle must sit on a face pointing away from the spawn corner."""
|
||||
for _ in range(20):
|
||||
room = Room()
|
||||
pos = room.marker_world_pos()
|
||||
assert pos is not None
|
||||
box = next(b for b in room.boxes if b.id == room.marker["box"])
|
||||
face = room.marker["face"]
|
||||
# spawn is at (1.5, 1.5); the marker face normal must point away from it
|
||||
to_spawn = (1.5 - box.cx, 1.5 - box.cz)
|
||||
normal = {
|
||||
"x0": (-1, 0), "x1": (1, 0), "z0": (0, -1), "z1": (0, 1),
|
||||
}[face]
|
||||
assert normal[0] * to_spawn[0] + normal[1] * to_spawn[1] < 0
|
||||
assert pos[0] == pytest.approx(box.x_max()) if face == "x1" else True
|
||||
|
||||
|
||||
def test_marker_not_visible_from_spawn():
|
||||
"""Looking toward the beacon from spawn must not show the triangle."""
|
||||
from testbed.room.render import Raycaster
|
||||
|
||||
room = Room()
|
||||
# Spawn looks at the beacon; the marker is on a back face, so the anchor
|
||||
# pixel of the marker must be occluded (different surface) or off-frame.
|
||||
pos = room.marker_world_pos()
|
||||
assert pos is not None
|
||||
# Stand on the marker's side of the crate, facing it.
|
||||
face = room.marker["face"]
|
||||
offsets = {
|
||||
"x0": (-1.0, 0.0, 90.0), # west face: stand west, face +x
|
||||
"x1": (1.0, 0.0, 270.0), # east face: stand east, face -x
|
||||
"z0": (0.0, -1.0, 0.0), # south face: stand south, face +z
|
||||
"z1": (0.0, 1.0, 180.0), # north face: stand north, face -z
|
||||
}[face]
|
||||
room.capsule.x = pos[0] + offsets[0]
|
||||
room.capsule.z = pos[2] + offsets[1]
|
||||
room.capsule.yaw_deg = offsets[2]
|
||||
img, _ = Raycaster().render(room)
|
||||
px = img.load()
|
||||
orange = 0
|
||||
for y in range(0, 120, 2):
|
||||
for x in range(0, 160, 2):
|
||||
r, g, b = px[x, y]
|
||||
if r > 200 and 100 < g < 190 and b < 90:
|
||||
orange += 1
|
||||
assert orange > 3, "triangle must be visible when looking at the marker face"
|
||||
|
||||
Reference in New Issue
Block a user