ludic/ns-grid.html
2026-09-17 22:10:03 +00:00

22 lines
No EOL
2.9 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Grid — Ludic</title>
<meta name="description" content="Tile geometry and pathfinding over the Map tilemap.">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">Grid</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Grid</h1></div>
<p class="ns-blurb">Tile geometry and pathfinding over the <a href="map"><code>Map</code></a> tilemap. A cell is passable unless it is out of bounds or holds the caller's <code>wall</code> tile (a char code, e.g. <code>'#'</code>), so any impassable glyph works. Everything is integer and deterministic — same map and query reproduce the same path every run. <a href="grid-line"><code>Grid.line</code></a>/<a href="grid-flood"><code>Grid.flood</code></a>/<a href="grid-a_star"><code>Grid.a_star</code></a> return <code>Cell</code> slices (index them with <code>len</code> / <code>[i]</code>; each cell has <code>.x</code> and <code>.y</code>).</p>
<div class="ns-methods"><a class="ns-method" href="grid-line.html"><code class="nm-sig">Grid.line(x0, y0, x1, y1) -&gt; []Cell</code><span class="nm-tip">Every cell a straight line from (x0,y0) to (x1,y1) crosses (Bresenham).</span></a><a class="ns-method" href="grid-blocked.html"><code class="nm-sig">Grid.blocked(x, y, wall) -&gt; bool</code><span class="nm-tip">True if the cell is out of bounds or holds the wall tile.</span></a><a class="ns-method" href="grid-line_of_sight.html"><code class="nm-sig">Grid.line_of_sight(x0, y0, x1, y1, wall) -&gt; bool</code><span class="nm-tip">True if the straight line between two cells crosses no wall.</span></a><a class="ns-method" href="grid-flood.html"><code class="nm-sig">Grid.flood(x, y, wall) -&gt; []Cell</code><span class="nm-tip">Every passable cell reachable from (x,y), 4-connected, in BFS order.</span></a><a class="ns-method" href="grid-a_star.html"><code class="nm-sig">Grid.a_star(x0, y0, x1, y1, wall) -&gt; []Cell</code><span class="nm-tip">The shortest 4-connected path between two cells (A*), or an empty list.</span></a></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>