lint: ruff-clean testbed (blocking file write to thread, unused vars)

This commit is contained in:
opencode
2026-08-08 04:29:51 +03:00
parent 132eb25c62
commit 4ced623b55
8 changed files with 42 additions and 19 deletions
+6 -7
View File
@@ -13,7 +13,7 @@ import math
from PIL import Image
from testbed.room.world import ROOM_HEIGHT, ROOM_SIZE, Box, Room
from testbed.room.world import ROOM_HEIGHT, ROOM_SIZE, Room
# Palette
FOG = (14, 14, 20)
@@ -83,10 +83,10 @@ class Raycaster:
row_top = self._row_of(ROOM_HEIGHT, t_wall, eye, tan_pitch)
row_bot = self._row_of(0.0, t_wall, eye, tan_pitch)
r_top = max(0, int(math.ceil(min(row_top, row_bot))))
r_bot = min(h, int(math.floor(max(row_top, row_bot))))
r_top = max(0, math.ceil(min(row_top, row_bot)))
r_bot = min(h, math.floor(max(row_top, row_bot)))
base = c * 3
c * 3
for r in range(h):
v = self.tan_fy * (1.0 - 2.0 * (r + 0.5) / h)
down = v + tan_pitch
@@ -252,7 +252,7 @@ class Raycaster:
return _fog(col, dist)
def _shade_floor(self, wx: float, wz: float, t: float) -> tuple[int, int, int]:
cell = int(math.floor(wx)) + int(math.floor(wz))
cell = math.floor(wx) + math.floor(wz)
col = FLOOR_A if cell % 2 == 0 else FLOOR_B
fx = wx - math.floor(wx)
fz = wz - math.floor(wz)
@@ -285,8 +285,7 @@ class Raycaster:
vv = (b.height - eye) / along - tan_pitch
row_c = (1.0 - vv / self.tan_fy) / 2.0 * h
r_px = b.radius / along / self.tan_fx * w / 2.0
if r_px < 1.2:
r_px = 1.2
r_px = max(r_px, 1.2)
glow = r_px * 3.4
pulse = 1.0