The ConTeXt typesetting system tightly integrates Lua. One aspect of Lua I dislike is that it isn't object-oriented. What's impressive is that the language can be extended to be so in astonishingly little code:
It's actually not ConTeXt which integrates Lua, but LuaTeX; ConTeXt is based on the features of LuaTeX. Lua includes all features required for OOP (see e.g. https://www.lua.org/pil/16.html).
* https://github.com/kikito/middleclass/blob/master/middleclas...
Using OOP, typesetting a hexagonal grid and a symbolic representation of a neural network on top is easier develop, IMO.
A vertex defines a point in 2D space:
* https://github.com/DaveJarvis/keenwrite-themes/blob/main/bos...
An edge connects two vertices:
* https://github.com/DaveJarvis/keenwrite-themes/blob/main/bos...
A graph connects edges:
* https://github.com/DaveJarvis/keenwrite-themes/blob/main/bos...
A priority queue serves for ordering edges by weight of adjoining vertices:
* https://github.com/DaveJarvis/keenwrite-themes/blob/main/bos...
With these concepts in hand, we can typeset a grid and a "neural network" on top:
* https://github.com/DaveJarvis/keenwrite-themes/blob/main/bos...
Here's an example of the output from the first chapter:
* https://i.ibb.co/19DCDZy/ch-1.png
And a later chapter, where the "network" has grown in complexity:
* https://i.ibb.co/ncf16vg/ch-2.png
This is for my near future hard sci-fi book on AGI. I'm looking for alpha readers to give me feedback. See profile for contact details.
P.S.
There's a subtle bug in the code that can result in one or two disconnected vertices. If you spot it, let me know!