Fog of war reveals the ground around the bot through rock (t17)

Also: board rule to write tasks from chat in our own words, task
descriptions rewritten that way, and a note on lost web-board descriptions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 12:29:08 -04:00
co-authored by Claude Opus 5.5
parent a95f664f7d
commit b4245871ae
11 changed files with 74 additions and 8 deletions
+11
View File
@@ -1,5 +1,6 @@
// Exploration only: never changes grains or the random stream.
const FOG = 2;
const FOG_SENSE = 20; // Reveal nearby ground through rock, in grains.
let fog, FW, FH;
function fogAlloc() { FW = Math.ceil(W / FOG); FH = Math.ceil(H / FOG); fog = new Uint8Array(FW * FH); }
function fogMark(x, y, v) {
@@ -28,6 +29,16 @@ function fogLook(cx, cy) {
fogMark(x, y, v);
}
}
// one fog cell at a time, measured from its centre; full inside FOG_SENSE - 4, fading to the edge
const R2 = FOG_SENSE * FOG_SENSE, in2 = (FOG_SENSE - 4) ** 2;
const fy0 = Math.max(0, Math.floor((cy - FOG_SENSE) / FOG)), fy1 = Math.min(FH - 1, Math.floor((cy + FOG_SENSE) / FOG));
const fx0 = Math.max(0, Math.floor((cx - FOG_SENSE) / FOG)), fx1 = Math.min(FW - 1, Math.floor((cx + FOG_SENSE) / FOG));
for (let fy = fy0; fy <= fy1; fy++) for (let fx = fx0; fx <= fx1; fx++) {
const dx = (fx + 0.5) * FOG - cx, dy = (fy + 0.5) * FOG - cy, d2 = dx * dx + dy * dy, i = fy * FW + fx;
if (d2 >= R2) continue;
const v = d2 <= in2 ? 255 : (FOG_SENSE - Math.sqrt(d2)) * 255 / 4;
if (v > fog[i]) fog[i] = v;
}
}
function fogRevealAround(x, y, r) {
for (let yy = Math.max(0, Math.floor(y - r)); yy <= Math.min(H - 1, y + r); yy++) for (let xx = Math.max(0, Math.floor(x - r)); xx <= Math.min(W - 1, x + r); xx++) if ((xx - x) ** 2 + (yy - y) ** 2 <= r * r) fogMark(xx, yy, 255);