The web, as defined above, then consists of three types of code, referred to as the "holy trinity" by some web developers, or just "html5", which is not in fact really html5 but a combination of the following:
In order to work with geometron you only need about a dozen commands to get started, all of which look like the italic form in the previous paragraph, with a tag in angle brackets and then an end tag also in angle brackets with a forward slash. This way of organizing information with angle brackets, slashes and tags, is part of a broader class of documents called eXtensible Markup Language, or XML. The way to start with HTML is to download and install a text editor with code capabilities such as textWrangler, which is the on I use, then copy and paste the code of a simple website into that, save it as something like "test.html", and open that file in your web browser(this file will be local on your harddrive and therefore not technically on the "Internet". You can then edit the text file, save it, re-load the browser and see the change.
Start with copy and pasting this into your text editor:
The second of the three main elements of the web is CSS, which stands for "cascaded style sheets". CSS is a whole language unto itself, which can exist in files that end with .css. These files are used by professional web developers to give a consistent and polished look to their professional work. That is not how it is used in Geometron, however. CSS can be and often is embedded inside html documents in the "<style>" tag. What it does is specify how all the html looks. Fonts, colors, margins, positions on the screen, etc. are all handled through CSS. The system incorporated in CSS allows for specific elements of the html document to be controlled, as well as types of element such as "paragraph" or "table", and classes, which can be defined by a class name.
CSS is a broad and deep subject, but for the purposes of Geometron we will just use some very basic pieces of it and define a class called a Geometron Atom. Now copy and paste the following code into "test.html".
For both html and CSS, the way to move forward is to go through the tutorials and references found on https://www.w3schools.com. As much as I hate to recommend a for profit company for anything, this is by far the most useful free resource for the amateur like me and I will strongly recommend it over the alternatives.
The third leg of the tripod is javaScript. This language is not to be confused with Java, which is supposedly unrelated(even though to those of us who don't care about the pointless territory battles of "tech" they both look identical to C). javaScript is a C-like language that can run in an html document. It runs on your browser! This is why I introduced the idea of the "Riddle of Steel" in the previous chapter. What matters in computer languages is only one thing: how many people does the thing talk to? And the web browser is the most powerful by many orders of magnitude.
Just as CSS code goes inside a "<style>" tag and can be in a .css file, JavaScript code can be inside a "<script>" tag or in a .js file. And just as we exclusively avoid external .css files in Geometron we mostly do the same with javascript. It is commonplace to put something like Geometron in a "library" file, an external .js file with all the needed JavaScript functions, and it would in many ways be more convenient to do this. However, this would contradict the goal of having each instance of Geometron be totally customizable and independent. External code libraries lead to central control which has political and philosophical implications. Therefore the core library functions of Geometron are always included in the html document which is referencing them. This is part of the process by which the language evolves.
The one exception to the no-external-libraries rule is the mathjax.js library. This allows for math to be typeset using commands from LaTeX, another markup language, older than the Web, which is designed specifically for typesetting mathematical documents. LaTeX is already very widely used in the physical sciences, so this is largely for those who are already comfortable with LaTeX and mathematics. If you need to create documents with very intense theoretical math, you very likely already know LaTeX, and if you don't, you don't need it. The Mathjax library appears to have a stable not-for-profit system of updating and maintaining their code which leads me to believe that trusting it for long term projects is safe. At least for now.
What you need to learn in JavaScript to do Geometron:
Hopefully it should be possible for amateurs to quickly learn just these things, use them to learn Geometron, and then work mostly in Geometron in the future. Some users will also inevitably delve much deeper into the language and use all of it to improve Geometron, but it is the goal to have the minimum needed JavaScript to edit the core library be something that can be learned in just a few days, and easily and quickly looked up again when forgotten. There should also be a reference in the Geometronsphere that has a list of examples of key things used.
Since I regard all techno priests as the class enemy of this work, I do not take this seriously. They want you to follow "security protocols" to make things work with large numbers of random scripts all being run at the same time, which might overlap and break each other. This has nothing to do with your functions or your freedom, it's about their(the technocratic enemy) ability to all control you without interfering with the other technocrats who are also trying to control you.
"Best practices[to use the Enemy's language]" in Geometron involve always having all scripts embedded in the html, with no outside scripts other than mathjax, and that only for mathematical work. Our goal is to not just have variables be global in the browser instance you happen to be running at this time, but to have names that follow the code into many future mutations and specific applications. The property-worshipper needs local variables to protect their right to live in a overpriced highrise where your place used to be after the condo developers bulldozed it. We will use global variables to attempt to fight their world and their values.
Geometron can be thought of as a virtual processor, which carries out operations on the global variables, just as a physical processor does things to registers and the accumulator(at least on the 6502).
commaCleaner
//remove extra commas from glyph: function commaCleaner(dirtyGlyph){ var dirtyArray = dirtyGlyph.split(","); var cleanGlyph = ""; for(var index = 0;index < dirtyArray.length;index++){ if(dirtyArray[index] != ""){ cleanGlyph += dirtyArray[index] + ","; } } return cleanGlyph; }
drawGlyph
spellGlyph
byteCode2string
string2byteCode
localRoot
appendGlyphButton
function doTheThing(localCommand){ if(localCommand == 0300){ x = x0; y = y0; theta = theta0; side = unit; thetaStep = Math.PI/2; scaleFactor = 2; ctx.lineWidth = 2; ctx.strokeStyle="black"; ctx.fillStyle="black"; } if(localCommand == 0304){ thetaStep = Math.PI/2; } if(localCommand == 0305){ thetaStep = 2*Math.PI/5; } if(localCommand == 0306){ thetaStep = Math.PI/3; } if(localCommand == 0310){ scaleFactor = Math.sqrt(2); } if(localCommand == 0311){ scaleFactor = phi; //"golden" ratio } if(localCommand == 0312){ scaleFactor = Math.sqrt(3); } if(localCommand == 0313){ scaleFactor = 2; //2x } if(localCommand == 0314){ scaleFactor = 3; //3x } if(localCommand == 0315){ scaleFactor = 3.14159; //pi* } if(localCommand == 0316){ scaleFactor = 5; //5* } if(localCommand == 0317){ side = unit; } if(localCommand == 0330){ x += side*Math.cos(theta); y += side*Math.sin(theta); } if(localCommand == 0331){ x -= side*Math.cos(theta); y -= side*Math.sin(theta); } if(localCommand == 0332){ x += side*Math.cos(theta - thetaStep); y += side*Math.sin(theta - thetaStep); } if(localCommand == 0333){ x += side*Math.cos(theta + thetaStep); y += side*Math.sin(theta + thetaStep); } if(localCommand == 0334){ theta -= thetaStep; // CCW } if(localCommand == 0335){ theta += thetaStep; // CW } if(localCommand == 0336){ side /= scaleFactor; // - } if(localCommand == 0337){ side *= scaleFactor; // + } if(localCommand == 0340){ //point ctx.beginPath(); ctx.arc(x, y, 3, 0, 2 * Math.PI); ctx.fill(); ctx.closePath(); } if(localCommand == 0341){ //circle ctx.beginPath(); ctx.arc(x, y, side, 0, 2 * Math.PI); ctx.closePath(); ctx.stroke(); } if(localCommand == 0342){ //line ctx.beginPath(); ctx.moveTo(x,y); ctx.lineTo(x + side*Math.cos(theta),y + side*Math.sin(theta)); ctx.stroke(); ctx.closePath(); } if(localCommand == 0343){ ctx.beginPath(); ctx.arc(x, y, side, theta - thetaStep,theta + thetaStep); ctx.stroke(); ctx.closePath(); } }Now is a good time to use your browser to read the source of this document and the previous chapters and future chapters to see how doTheThing changes for various instances of Geometron.