The result

dharmatiles version="1.0.0"
// A line may cross a square's edge only at a seam: a corner, a third, a half or two thirds.
// `wsw` is two thirds of the way down the west side, `ene` a third down the east side, so the
// next tile over, which has the same seams, continues the line where it stops.
tile size="2x1" seed=6 {
line shore wobble="3dmm" { through "wsw" "ene" }
region bank { boundedBy shore; fill "(1sq, 0.1sq)" }
stack {
base
dirt
grass at=bank
}
}
Say it plainly
Every square edge has the same few seams: the corners, a third, a half and two thirds. Two tiles that meet at a seam meet in the same place, and in the same direction.
Each seam has a short compass word (wsw, n, ese), so you rarely write a number. When a point is off a seam the program names the nearest and can move it for you.
The rules
A point near a side, or a range on one, is refused
A point within 1 mm of a side but not on it is dt::near-edge, with a fix that moves it onto the side. A range on a point that lies on a side is dt::edge-range: it would draw a different place for each seed; the fix writes the range’s middle as the one place (and if that is no seam, the next check offers the nearest).
A line crosses a square’s edge only at a seam
A line may cross the edge of a square only at a seam: the same few places on every square edge, listed in the edge contract (library/parts/edges.dtile) and shown on the tile system page: the corners, a third, a half and two thirds. A point on a tile side that is not a seam is dt::seam, naming the square (column 2, row 1, north side, at 0.45 is not a seam) with a fix that moves it to the nearest seam on that square. Squares are named column then row, counted from 1: C1 R1 is the north-west square. Positions measure from each square’s own corner, so a 2×2’s north side has two sets of seams, one for column 1 and one for column 2. A third is written exactly, 1sq/3, never 0.33; the point partway along a side where two squares meet is not a seam, only the tile’s own corners are. A tile that must cross an edge elsewhere writes seams=free.
A seam also has a word, from the table in the edge contract: on the north side nnw, n and nne are a third, a half and two thirds along from the west; ssw s sse on the south; wnw w wsw on the west and ene e ese on the east, from the north. nw ne se sw are the tile’s own corners and never take a number. On a side longer than one square the word takes its square, counted from 1 from the west (north and south sides) or the north (west and east sides), and is written quoted because KDL does not allow brackets in a bare word: through "nnw(2)" e. On a one-square side the word stands alone (e(1) means the same). A bare side word on a longer side is an error that lists the numbered forms; a word that is nearly one is offered as a fix, and a point written as a number that lands exactly on a seam is as good as its word. The program keeps no list of its own: the words are in library/parts/edges.dtile.
tile size="2x2" seed=1 {
line a { through "wnw(1)" "ese(2)" } // column 1, row 1's west side at a third, to column 2, row 2's east side at two thirds
line b { through "n(1)" "s(2)" } // the middle of the first column's north edge to the middle of the second's south edge
line c { through "(0sq, 1sq/3)" "(2sq, 5sq/3)" } // the first line written as points
}
tile size="1x1" seams=free { … } // no seam check
A mistake with one exact mend carries its fix
A mistake that has one exact mend carries it: dt::seam (the nearest seam, as its word), dt::near-edge (the point on the side), dt::edge-range (the range’s middle), a misspelt element, control or seam word with a near one, an old spelling of a control (per-square), and a corner or one-square side written with a number (nw(2)). The help says the mend (did you mean wsw?) and the fix is that same edit, made once where the mistake is made, so the words and the change cannot differ. In the editor, the mark in the source, the messages panel and the error card show the fix as a button; one press writes it into the source as one step of the history, and Undo takes it back.
dharmatiles fix tile.dtile does it from the command line, for a file or a folder of tiles: it shows each change (file, line, the text before and after and, for a moved point, how far it moves in millimetres on the build target’s square, --system ol for OpenLOCK) and writes nothing; --write writes the files. A fix can show the next mistake, so it checks again and repeats (up to eight rounds). A mistake with no exact mend (a choice is needed) is left, shown as check shows it, and ends the run with a non-zero status. Tiles of the program’s library are not written.
Errors this page explains
dt::near-edgeA point is within a millimetre of a side of the tile but not on it The ruledt::edge-rangeA point on a side of the tile has a range, so each seed would put it somewhere else on the side The ruledt::seamA line crosses a square's edge where no seam is, so it would not meet the next tile's The ruledt::seamsThe seam table in the edge contract cannot be read, or is missing The rule
Next
Next: regions, the areas lines divide a tile into.